{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/26581464","id":26581464,"diff_hunk":"@@ -0,0 +1,100 @@\n+/* This Source Code Form is subject to the terms of the Mozilla Public\n+ * License, v. 2.0. If a copy of the MPL was not distributed with this\n+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n+\n+\"use strict\";\n+var aws = require('aws-sdk');\n+var encode = require('../utils').encode;\n+var decode = require('../utils').decode;\n+var isUndefined = require('../utils').isUndefined;\n+\n+var DEFAULT_PUBLIC_BUCKET = \"room_encrypted_files\";\n+var CONTENT_TYPE = \"application/json\";\n+\n+function AwsDriver(options, settings) {\n+  this._settings = settings || {};\n+  this._publicBucket = options.publicBucket || DEFAULT_PUBLIC_BUCKET;\n+  if (!/^[a-zA-Z0-9_\\-]+$/.test(this._publicBucket)) {\n+    throw new Error('Illegal Bucket Name: ' + this._publicBucket);\n+  }\n+  this._s3 = new aws.S3();\n+}\n+\n+AwsDriver.prototype = {\n+\n+  /**\n+   * Create or override a file.\n+   *\n+   * @param {String}    filename, the filename of the object to store.\n+   * @param {String}    body, the content of the file to store\n+   * @param {Function}  A callback that will be called once data had been\n+   *                    stored.\n+   **/\n+  write: function(filename, body, callback) {\n+    if (isUndefined(filename, \"filename\", callback)) return;\n+    if (body === undefined) return callback(null, null);","path":"loop/files/aws.js","position":35,"original_position":35,"commit_id":"a9e743e7ad621694acb4de5e40e2720388f62a00","original_commit_id":"6d9420f3a491bffa4d3e29d560ac28e3b631d714","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"body":"I find this a bit weird: if no data is provided, we act like if we wrote something by returning no error and a null content?","created_at":"2015-03-17T15:15:35Z","updated_at":"2015-03-17T15:15:35Z","html_url":"https://github.com/mozilla-services/loop-server/pull/322#discussion_r26581464","pull_request_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/26581464"},"html":{"href":"https://github.com/mozilla-services/loop-server/pull/322#discussion_r26581464"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322","id":31045017,"html_url":"https://github.com/mozilla-services/loop-server/pull/322","diff_url":"https://github.com/mozilla-services/loop-server/pull/322.diff","patch_url":"https://github.com/mozilla-services/loop-server/pull/322.patch","issue_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/322","number":322,"state":"open","locked":false,"title":"Bug 1141105 — Add the filesystem file storage.","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"body":"Work in Progress\r\n\r\n - [x] Create a FileSystemBackend\r\n - [x] Create a S3 file storage backend\r\n - [x] Use the backend to store roomContextData\r\n - [ ] Handle the roomExpiration TTL on the roomContextData","created_at":"2015-03-12T15:12:19Z","updated_at":"2015-03-17T15:15:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cda3783bcc50951610dfb22240cd4b11f82237b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/322/comments","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/a9e743e7ad621694acb4de5e40e2720388f62a00","head":{"label":"mozilla-services:1141105-room-context-sharing","ref":"1141105-room-context-sharing","sha":"a9e743e7ad621694acb4de5e40e2720388f62a00","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":17026140,"name":"loop-server","full_name":"mozilla-services/loop-server","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/loop-server","description":"The mozilla loop server","fork":false,"url":"https://api.github.com/repos/mozilla-services/loop-server","forks_url":"https://api.github.com/repos/mozilla-services/loop-server/forks","keys_url":"https://api.github.com/repos/mozilla-services/loop-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/loop-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/loop-server/teams","hooks_url":"https://api.github.com/repos/mozilla-services/loop-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/loop-server/events","assignees_url":"https://api.github.com/repos/mozilla-services/loop-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/loop-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/loop-server/tags","blobs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/loop-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/loop-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/loop-server/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/loop-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/loop-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/loop-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/loop-server/subscription","commits_url":"https://api.github.com/repos/mozilla-services/loop-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/loop-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-services/loop-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/loop-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/loop-server/merges","archive_url":"https://api.github.com/repos/mozilla-services/loop-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/loop-server/downloads","issues_url":"https://api.github.com/repos/mozilla-services/loop-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/loop-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/loop-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/loop-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/loop-server/releases{/id}","created_at":"2014-02-20T16:02:00Z","updated_at":"2015-03-12T15:23:02Z","pushed_at":"2015-03-17T15:12:34Z","git_url":"git://github.com/mozilla-services/loop-server.git","ssh_url":"git@github.com:mozilla-services/loop-server.git","clone_url":"https://github.com/mozilla-services/loop-server.git","svn_url":"https://github.com/mozilla-services/loop-server","homepage":"https://docs.services.mozilla.com/loop/apis.html","size":7534,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":2,"forks":12,"open_issues":2,"watchers":33,"default_branch":"master"}},"base":{"label":"mozilla-services:master","ref":"master","sha":"39cb70d6ef10b18fb8b8dd2f8414ec23fec87f6d","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":17026140,"name":"loop-server","full_name":"mozilla-services/loop-server","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/loop-server","description":"The mozilla loop server","fork":false,"url":"https://api.github.com/repos/mozilla-services/loop-server","forks_url":"https://api.github.com/repos/mozilla-services/loop-server/forks","keys_url":"https://api.github.com/repos/mozilla-services/loop-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/loop-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/loop-server/teams","hooks_url":"https://api.github.com/repos/mozilla-services/loop-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/loop-server/events","assignees_url":"https://api.github.com/repos/mozilla-services/loop-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/loop-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/loop-server/tags","blobs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/loop-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/loop-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/loop-server/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/loop-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/loop-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/loop-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/loop-server/subscription","commits_url":"https://api.github.com/repos/mozilla-services/loop-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/loop-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-services/loop-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/loop-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/loop-server/merges","archive_url":"https://api.github.com/repos/mozilla-services/loop-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/loop-server/downloads","issues_url":"https://api.github.com/repos/mozilla-services/loop-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/loop-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/loop-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/loop-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/loop-server/releases{/id}","created_at":"2014-02-20T16:02:00Z","updated_at":"2015-03-12T15:23:02Z","pushed_at":"2015-03-17T15:12:34Z","git_url":"git://github.com/mozilla-services/loop-server.git","ssh_url":"git@github.com:mozilla-services/loop-server.git","clone_url":"https://github.com/mozilla-services/loop-server.git","svn_url":"https://github.com/mozilla-services/loop-server","homepage":"https://docs.services.mozilla.com/loop/apis.html","size":7534,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":2,"forks":12,"open_issues":2,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322"},"html":{"href":"https://github.com/mozilla-services/loop-server/pull/322"},"issue":{"href":"https://api.github.com/repos/mozilla-services/loop-server/issues/322"},"comments":{"href":"https://api.github.com/repos/mozilla-services/loop-server/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/loop-server/statuses/a9e743e7ad621694acb4de5e40e2720388f62a00"}}}}