{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/comments/90199830","pull_request_review_id":10721017,"id":90199830,"diff_hunk":"@@ -18,61 +18,75 @@\n const gcloud = require('google-cloud');\n const config = require('../config/config');\n const sharp = require('sharp');\n-\n+const strongDataUri = require('strong-data-uri');\n+const stream = require('stream');\n const CLOUD_BUCKET = config.get('CLOUD_BUCKET');\n-\n+const dataFetcher = require('../lib/data-fetcher');\n const storage = gcloud.storage({\n   projectId: config.get('GCLOUD_PROJECT')\n });\n const bucket = storage.bucket(CLOUD_BUCKET);\n-const fetch = require('node-fetch');\n const CACHE_CONTROL_EXPIRES = 60 * 60 * 24; // 1 day.\n \n /**\n- * Fetches and Saves an Image to GCloud.\n+ * Fetches and Saves an Image to Google Cloud Storage.\n  *\n  * @param {string} url image URL to retrieve\n- * @param {string} destFile name of the destination file on GCP\n- * @return {Promise<string>}\n+ * @param {string} destFile name of the destination file\n+ * @return {Promise<url[]>>} URLs for the new images in Google Cloud Storage\n  */\n function fetchAndSave(url, destFile) {\n-  return new Promise((resolve, reject) => {\n-    fetch(url)\n-      .then(response => {\n-        if (response.status !== 200) {\n-          reject(\n-            new Error('Bad Response (' + response.status + ') loading image: ' + response.url));\n-        }\n-        const contentType = response.headers.get('Content-Type');\n+  if (url.startsWith('data:')) {","path":"lib/images.js","position":36,"original_position":36,"commit_id":"d825226eb21213a33da5d6fd55de08276963d765","original_commit_id":"d825226eb21213a33da5d6fd55de08276963d765","user":{"login":"andreban","id":1733592,"avatar_url":"https://avatars.githubusercontent.com/u/1733592?v=3","gravatar_id":"","url":"https://api.github.com/users/andreban","html_url":"https://github.com/andreban","followers_url":"https://api.github.com/users/andreban/followers","following_url":"https://api.github.com/users/andreban/following{/other_user}","gists_url":"https://api.github.com/users/andreban/gists{/gist_id}","starred_url":"https://api.github.com/users/andreban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreban/subscriptions","organizations_url":"https://api.github.com/users/andreban/orgs","repos_url":"https://api.github.com/users/andreban/repos","events_url":"https://api.github.com/users/andreban/events{/privacy}","received_events_url":"https://api.github.com/users/andreban/received_events","type":"User","site_admin":false},"body":"So, we currently support `http`, `https` and `data` protocol. We could write this as  \r\nswitch(protocol) {\r\n  case 'data': {\r\n    //...\r\n  } \r\n  case 'http': \r\n  case 'https': {\r\n    // ...\r\n  }\r\n  default: {\r\n    return Promise.reject('Unsupported Protocol: ' + protocol);\r\n  }\r\n}","created_at":"2016-11-30T09:54:25Z","updated_at":"2016-11-30T09:59:28Z","html_url":"https://github.com/GoogleChrome/gulliver/pull/256#discussion_r90199830","pull_request_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/comments/90199830"},"html":{"href":"https://github.com/GoogleChrome/gulliver/pull/256#discussion_r90199830"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256","id":95772775,"html_url":"https://github.com/GoogleChrome/gulliver/pull/256","diff_url":"https://github.com/GoogleChrome/gulliver/pull/256.diff","patch_url":"https://github.com/GoogleChrome/gulliver/pull/256.patch","issue_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/256","number":256,"state":"open","locked":false,"title":"Manifest fixes","user":{"login":"juliantoledo","id":1920764,"avatar_url":"https://avatars.githubusercontent.com/u/1920764?v=3","gravatar_id":"","url":"https://api.github.com/users/juliantoledo","html_url":"https://github.com/juliantoledo","followers_url":"https://api.github.com/users/juliantoledo/followers","following_url":"https://api.github.com/users/juliantoledo/following{/other_user}","gists_url":"https://api.github.com/users/juliantoledo/gists{/gist_id}","starred_url":"https://api.github.com/users/juliantoledo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliantoledo/subscriptions","organizations_url":"https://api.github.com/users/juliantoledo/orgs","repos_url":"https://api.github.com/users/juliantoledo/repos","events_url":"https://api.github.com/users/juliantoledo/events{/privacy}","received_events_url":"https://api.github.com/users/juliantoledo/received_events","type":"User","site_admin":false},"body":"Added fixes for #255 and #231","created_at":"2016-11-29T20:51:02Z","updated_at":"2016-11-30T09:59:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f835622becc092527191069b0f2d100255c47dcf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/256/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/gulliver/statuses/d825226eb21213a33da5d6fd55de08276963d765","head":{"label":"GoogleChrome:manifest-fixes","ref":"manifest-fixes","sha":"d825226eb21213a33da5d6fd55de08276963d765","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":63147532,"name":"gulliver","full_name":"GoogleChrome/gulliver","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/gulliver","description":"A PWA directory, focusing on collecting PWA best practices and examples.","fork":false,"url":"https://api.github.com/repos/GoogleChrome/gulliver","forks_url":"https://api.github.com/repos/GoogleChrome/gulliver/forks","keys_url":"https://api.github.com/repos/GoogleChrome/gulliver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/gulliver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/gulliver/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/gulliver/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/gulliver/events","assignees_url":"https://api.github.com/repos/GoogleChrome/gulliver/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/gulliver/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/gulliver/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/gulliver/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/gulliver/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/gulliver/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/gulliver/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/gulliver/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/gulliver/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/gulliver/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/gulliver/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/gulliver/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/gulliver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/gulliver/merges","archive_url":"https://api.github.com/repos/GoogleChrome/gulliver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/gulliver/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/gulliver/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/gulliver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/gulliver/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/gulliver/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/gulliver/deployments","created_at":"2016-07-12T10:03:03Z","updated_at":"2016-11-30T00:05:07Z","pushed_at":"2016-11-30T09:07:19Z","git_url":"git://github.com/GoogleChrome/gulliver.git","ssh_url":"git@github.com:GoogleChrome/gulliver.git","clone_url":"https://github.com/GoogleChrome/gulliver.git","svn_url":"https://github.com/GoogleChrome/gulliver","homepage":"https://pwa-directory.appspot.com/","size":1654,"stargazers_count":47,"watchers_count":47,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":19,"forks":8,"open_issues":19,"watchers":47,"default_branch":"master"}},"base":{"label":"GoogleChrome:master","ref":"master","sha":"069b144381f51c7ef0f5913fe3c289cbb197f4ef","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":63147532,"name":"gulliver","full_name":"GoogleChrome/gulliver","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/gulliver","description":"A PWA directory, focusing on collecting PWA best practices and examples.","fork":false,"url":"https://api.github.com/repos/GoogleChrome/gulliver","forks_url":"https://api.github.com/repos/GoogleChrome/gulliver/forks","keys_url":"https://api.github.com/repos/GoogleChrome/gulliver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/gulliver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/gulliver/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/gulliver/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/gulliver/events","assignees_url":"https://api.github.com/repos/GoogleChrome/gulliver/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/gulliver/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/gulliver/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/gulliver/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/gulliver/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/gulliver/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/gulliver/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/gulliver/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/gulliver/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/gulliver/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/gulliver/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/gulliver/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/gulliver/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/gulliver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/gulliver/merges","archive_url":"https://api.github.com/repos/GoogleChrome/gulliver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/gulliver/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/gulliver/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/gulliver/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/gulliver/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/gulliver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/gulliver/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/gulliver/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/gulliver/deployments","created_at":"2016-07-12T10:03:03Z","updated_at":"2016-11-30T00:05:07Z","pushed_at":"2016-11-30T09:07:19Z","git_url":"git://github.com/GoogleChrome/gulliver.git","ssh_url":"git@github.com:GoogleChrome/gulliver.git","clone_url":"https://github.com/GoogleChrome/gulliver.git","svn_url":"https://github.com/GoogleChrome/gulliver","homepage":"https://pwa-directory.appspot.com/","size":1654,"stargazers_count":47,"watchers_count":47,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":19,"forks":8,"open_issues":19,"watchers":47,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256"},"html":{"href":"https://github.com/GoogleChrome/gulliver/pull/256"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/issues/256"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/issues/256/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/pulls/256/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/gulliver/statuses/d825226eb21213a33da5d6fd55de08276963d765"}}}}
{"actor":{"display_login":"andreban"}}