{"action":"created","comment":{"url":"https://api.github.com/repos/strapi/strapi/pulls/comments/170212264","pull_request_review_id":98864762,"id":170212264,"diff_hunk":"@@ -15,31 +17,80 @@ module.exports = {\n    */\n \n   index: async (ctx) => {\n+    console.log(ctx.request.body.files);\n+    const config = await strapi.store({\n+      environment: strapi.config.environment,\n+      type: 'plugin',\n+      name: 'upload'\n+    }).get({key: 'provider'});\n+\n+    if (!config.enabled) {\n+      return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Upload.status.disabled' }] }] : 'Upload is disabled!');\n+    }\n+\n     const Service = strapi.plugins['upload'].services.upload;\n \n-    const files = await Service.buffurize(ctx.request.body.files);\n+    // transform stream files to buffer\n+    const files = await Service.bufferize(ctx.request.body.files);\n \n-    await Service.upload(files);\n+    for (var i = 0; i < files.length; i++) {\n+      if (files[i].size > config.sizeLimit) {\n+        return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Upload.status.sizeLimit' }] }] : 'One of file is bigger than limit size!');","path":"packages/strapi-plugin-upload/controllers/Upload.js","position":33,"original_position":33,"commit_id":"d512d503b1b430764abac2a0c03e349428c92103","original_commit_id":"d512d503b1b430764abac2a0c03e349428c92103","user":{"login":"Aurelsicoko","id":4144726,"avatar_url":"https://avatars0.githubusercontent.com/u/4144726?v=4","gravatar_id":"","url":"https://api.github.com/users/Aurelsicoko","html_url":"https://github.com/Aurelsicoko","followers_url":"https://api.github.com/users/Aurelsicoko/followers","following_url":"https://api.github.com/users/Aurelsicoko/following{/other_user}","gists_url":"https://api.github.com/users/Aurelsicoko/gists{/gist_id}","starred_url":"https://api.github.com/users/Aurelsicoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aurelsicoko/subscriptions","organizations_url":"https://api.github.com/users/Aurelsicoko/orgs","repos_url":"https://api.github.com/users/Aurelsicoko/repos","events_url":"https://api.github.com/users/Aurelsicoko/events{/privacy}","received_events_url":"https://api.github.com/users/Aurelsicoko/received_events","type":"User","site_admin":false},"body":"Maybe the error could be more precise and say what's the file which is too large?","created_at":"2018-02-23T10:09:38Z","updated_at":"2018-02-23T10:09:39Z","html_url":"https://github.com/strapi/strapi/pull/684#discussion_r170212264","pull_request_url":"https://api.github.com/repos/strapi/strapi/pulls/684","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/strapi/strapi/pulls/comments/170212264"},"html":{"href":"https://github.com/strapi/strapi/pull/684#discussion_r170212264"},"pull_request":{"href":"https://api.github.com/repos/strapi/strapi/pulls/684"}}},"pull_request":{"url":"https://api.github.com/repos/strapi/strapi/pulls/684","id":170711861,"html_url":"https://github.com/strapi/strapi/pull/684","diff_url":"https://github.com/strapi/strapi/pull/684.diff","patch_url":"https://github.com/strapi/strapi/pull/684.patch","issue_url":"https://api.github.com/repos/strapi/strapi/issues/684","number":684,"state":"open","locked":false,"title":"File upload s3","user":{"login":"lauriejim","id":5716596,"avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false},"body":"- Move upload logic in provider's module\r\n- Create AWS S3 module\r\n- Add enabled, size limit and provider auth settings\r\n-  Search file route by name or hash\r\n","created_at":"2018-02-22T10:33:46Z","updated_at":"2018-02-23T10:09:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9630c911e010d122e824c9bc218f7709dc40be3d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/strapi/strapi/pulls/684/commits","review_comments_url":"https://api.github.com/repos/strapi/strapi/pulls/684/comments","review_comment_url":"https://api.github.com/repos/strapi/strapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strapi/strapi/issues/684/comments","statuses_url":"https://api.github.com/repos/strapi/strapi/statuses/d512d503b1b430764abac2a0c03e349428c92103","head":{"label":"strapi:file-upload-s3","ref":"file-upload-s3","sha":"d512d503b1b430764abac2a0c03e349428c92103","user":{"login":"strapi","id":19872173,"avatar_url":"https://avatars2.githubusercontent.com/u/19872173?v=4","gravatar_id":"","url":"https://api.github.com/users/strapi","html_url":"https://github.com/strapi","followers_url":"https://api.github.com/users/strapi/followers","following_url":"https://api.github.com/users/strapi/following{/other_user}","gists_url":"https://api.github.com/users/strapi/gists{/gist_id}","starred_url":"https://api.github.com/users/strapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strapi/subscriptions","organizations_url":"https://api.github.com/users/strapi/orgs","repos_url":"https://api.github.com/users/strapi/repos","events_url":"https://api.github.com/users/strapi/events{/privacy}","received_events_url":"https://api.github.com/users/strapi/received_events","type":"Organization","site_admin":false},"repo":{"id":43441403,"name":"strapi","full_name":"strapi/strapi","owner":{"login":"strapi","id":19872173,"avatar_url":"https://avatars2.githubusercontent.com/u/19872173?v=4","gravatar_id":"","url":"https://api.github.com/users/strapi","html_url":"https://github.com/strapi","followers_url":"https://api.github.com/users/strapi/followers","following_url":"https://api.github.com/users/strapi/following{/other_user}","gists_url":"https://api.github.com/users/strapi/gists{/gist_id}","starred_url":"https://api.github.com/users/strapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strapi/subscriptions","organizations_url":"https://api.github.com/users/strapi/orgs","repos_url":"https://api.github.com/users/strapi/repos","events_url":"https://api.github.com/users/strapi/events{/privacy}","received_events_url":"https://api.github.com/users/strapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strapi/strapi","description":":rocket: Node.js Content Management Framework (headless-CMS) to build powerful API with no effort.","fork":false,"url":"https://api.github.com/repos/strapi/strapi","forks_url":"https://api.github.com/repos/strapi/strapi/forks","keys_url":"https://api.github.com/repos/strapi/strapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strapi/strapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strapi/strapi/teams","hooks_url":"https://api.github.com/repos/strapi/strapi/hooks","issue_events_url":"https://api.github.com/repos/strapi/strapi/issues/events{/number}","events_url":"https://api.github.com/repos/strapi/strapi/events","assignees_url":"https://api.github.com/repos/strapi/strapi/assignees{/user}","branches_url":"https://api.github.com/repos/strapi/strapi/branches{/branch}","tags_url":"https://api.github.com/repos/strapi/strapi/tags","blobs_url":"https://api.github.com/repos/strapi/strapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strapi/strapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strapi/strapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/strapi/strapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strapi/strapi/statuses/{sha}","languages_url":"https://api.github.com/repos/strapi/strapi/languages","stargazers_url":"https://api.github.com/repos/strapi/strapi/stargazers","contributors_url":"https://api.github.com/repos/strapi/strapi/contributors","subscribers_url":"https://api.github.com/repos/strapi/strapi/subscribers","subscription_url":"https://api.github.com/repos/strapi/strapi/subscription","commits_url":"https://api.github.com/repos/strapi/strapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/strapi/strapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/strapi/strapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/strapi/strapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/strapi/strapi/contents/{+path}","compare_url":"https://api.github.com/repos/strapi/strapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strapi/strapi/merges","archive_url":"https://api.github.com/repos/strapi/strapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strapi/strapi/downloads","issues_url":"https://api.github.com/repos/strapi/strapi/issues{/number}","pulls_url":"https://api.github.com/repos/strapi/strapi/pulls{/number}","milestones_url":"https://api.github.com/repos/strapi/strapi/milestones{/number}","notifications_url":"https://api.github.com/repos/strapi/strapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strapi/strapi/labels{/name}","releases_url":"https://api.github.com/repos/strapi/strapi/releases{/id}","deployments_url":"https://api.github.com/repos/strapi/strapi/deployments","created_at":"2015-09-30T15:34:48Z","updated_at":"2018-02-23T10:03:35Z","pushed_at":"2018-02-22T17:55:56Z","git_url":"git://github.com/strapi/strapi.git","ssh_url":"git@github.com:strapi/strapi.git","clone_url":"https://github.com/strapi/strapi.git","svn_url":"https://github.com/strapi/strapi","homepage":"https://strapi.io","size":32016,"stargazers_count":3406,"watchers_count":3406,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":258,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":258,"open_issues":53,"watchers":3406,"default_branch":"master"}},"base":{"label":"strapi:master","ref":"master","sha":"e41a788aef295bd7f69e87e2595029a2a120a504","user":{"login":"strapi","id":19872173,"avatar_url":"https://avatars2.githubusercontent.com/u/19872173?v=4","gravatar_id":"","url":"https://api.github.com/users/strapi","html_url":"https://github.com/strapi","followers_url":"https://api.github.com/users/strapi/followers","following_url":"https://api.github.com/users/strapi/following{/other_user}","gists_url":"https://api.github.com/users/strapi/gists{/gist_id}","starred_url":"https://api.github.com/users/strapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strapi/subscriptions","organizations_url":"https://api.github.com/users/strapi/orgs","repos_url":"https://api.github.com/users/strapi/repos","events_url":"https://api.github.com/users/strapi/events{/privacy}","received_events_url":"https://api.github.com/users/strapi/received_events","type":"Organization","site_admin":false},"repo":{"id":43441403,"name":"strapi","full_name":"strapi/strapi","owner":{"login":"strapi","id":19872173,"avatar_url":"https://avatars2.githubusercontent.com/u/19872173?v=4","gravatar_id":"","url":"https://api.github.com/users/strapi","html_url":"https://github.com/strapi","followers_url":"https://api.github.com/users/strapi/followers","following_url":"https://api.github.com/users/strapi/following{/other_user}","gists_url":"https://api.github.com/users/strapi/gists{/gist_id}","starred_url":"https://api.github.com/users/strapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strapi/subscriptions","organizations_url":"https://api.github.com/users/strapi/orgs","repos_url":"https://api.github.com/users/strapi/repos","events_url":"https://api.github.com/users/strapi/events{/privacy}","received_events_url":"https://api.github.com/users/strapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strapi/strapi","description":":rocket: Node.js Content Management Framework (headless-CMS) to build powerful API with no effort.","fork":false,"url":"https://api.github.com/repos/strapi/strapi","forks_url":"https://api.github.com/repos/strapi/strapi/forks","keys_url":"https://api.github.com/repos/strapi/strapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strapi/strapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strapi/strapi/teams","hooks_url":"https://api.github.com/repos/strapi/strapi/hooks","issue_events_url":"https://api.github.com/repos/strapi/strapi/issues/events{/number}","events_url":"https://api.github.com/repos/strapi/strapi/events","assignees_url":"https://api.github.com/repos/strapi/strapi/assignees{/user}","branches_url":"https://api.github.com/repos/strapi/strapi/branches{/branch}","tags_url":"https://api.github.com/repos/strapi/strapi/tags","blobs_url":"https://api.github.com/repos/strapi/strapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strapi/strapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strapi/strapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/strapi/strapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strapi/strapi/statuses/{sha}","languages_url":"https://api.github.com/repos/strapi/strapi/languages","stargazers_url":"https://api.github.com/repos/strapi/strapi/stargazers","contributors_url":"https://api.github.com/repos/strapi/strapi/contributors","subscribers_url":"https://api.github.com/repos/strapi/strapi/subscribers","subscription_url":"https://api.github.com/repos/strapi/strapi/subscription","commits_url":"https://api.github.com/repos/strapi/strapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/strapi/strapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/strapi/strapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/strapi/strapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/strapi/strapi/contents/{+path}","compare_url":"https://api.github.com/repos/strapi/strapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strapi/strapi/merges","archive_url":"https://api.github.com/repos/strapi/strapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strapi/strapi/downloads","issues_url":"https://api.github.com/repos/strapi/strapi/issues{/number}","pulls_url":"https://api.github.com/repos/strapi/strapi/pulls{/number}","milestones_url":"https://api.github.com/repos/strapi/strapi/milestones{/number}","notifications_url":"https://api.github.com/repos/strapi/strapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strapi/strapi/labels{/name}","releases_url":"https://api.github.com/repos/strapi/strapi/releases{/id}","deployments_url":"https://api.github.com/repos/strapi/strapi/deployments","created_at":"2015-09-30T15:34:48Z","updated_at":"2018-02-23T10:03:35Z","pushed_at":"2018-02-22T17:55:56Z","git_url":"git://github.com/strapi/strapi.git","ssh_url":"git@github.com:strapi/strapi.git","clone_url":"https://github.com/strapi/strapi.git","svn_url":"https://github.com/strapi/strapi","homepage":"https://strapi.io","size":32016,"stargazers_count":3406,"watchers_count":3406,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":258,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":258,"open_issues":53,"watchers":3406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strapi/strapi/pulls/684"},"html":{"href":"https://github.com/strapi/strapi/pull/684"},"issue":{"href":"https://api.github.com/repos/strapi/strapi/issues/684"},"comments":{"href":"https://api.github.com/repos/strapi/strapi/issues/684/comments"},"review_comments":{"href":"https://api.github.com/repos/strapi/strapi/pulls/684/comments"},"review_comment":{"href":"https://api.github.com/repos/strapi/strapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strapi/strapi/pulls/684/commits"},"statuses":{"href":"https://api.github.com/repos/strapi/strapi/statuses/d512d503b1b430764abac2a0c03e349428c92103"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Aurelsicoko"}}