{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/comments/122055050","pull_request_review_id":44137647,"id":122055050,"diff_hunk":"@@ -58,25 +58,32 @@ const MAX_DOMAIN_LABEL_LENGTH_ = 63;\n  * @param {string} url The complete publisher url.\n  * @param {object} initParams Params containing origin, etc.\n  * @param {string} opt_cacheUrlAuthority\n- * @param {string} opt_viewer_js_version\n- * @return {string} the Cache Url.\n+ * @param {string} opt_viewerJsVersion\n+ * @return {!Promise<string>}\n  * @private\n  */\n export function constructViewerCacheUrl(url, initParams,\n-  opt_cacheUrlAuthority, opt_viewer_js_version) {\n+  opt_cacheUrlAuthority, opt_viewerJsVersion) {\n   const parsedUrl = parseUrl(url);\n-  const cacheDomain = constructCacheDomainUrl_(url, opt_cacheUrlAuthority);\n   const protocolStr = parsedUrl.protocol == 'https:' ? 's/' : '';\n-  const viewerJsVersion = opt_viewer_js_version ? opt_viewer_js_version :\n+  const viewerJsVersion = opt_viewerJsVersion ? opt_viewerJsVersion :\n     DEFAULT_VIEWER_JS_VERSION_;\n \n-  return cacheDomain + \n+  return new Promise(resolve => {\n+    constructCacheDomainUrl_(parsedUrl.host, opt_cacheUrlAuthority).then(cacheDomain => {\n+      resolve(\n+        parsedUrl.protocol + '//' +\n+        cacheDomain + \n           '/v/' +\n           protocolStr +\n           parsedUrl.host + \n-          '/?amp_js_v=' + viewerJsVersion +\n+          parsedUrl.pathname +\n+          '?amp_js_v=' + viewerJsVersion +","path":"src/amp-url-creator.js","position":31,"original_position":31,"commit_id":"e423e180376266d507333a535b3ab4e7d60d24c8","original_commit_id":"e423e180376266d507333a535b3ab4e7d60d24c8","user":{"login":"ericfs","id":851850,"avatar_url":"https://avatars1.githubusercontent.com/u/851850?v=3","gravatar_id":"","url":"https://api.github.com/users/ericfs","html_url":"https://github.com/ericfs","followers_url":"https://api.github.com/users/ericfs/followers","following_url":"https://api.github.com/users/ericfs/following{/other_user}","gists_url":"https://api.github.com/users/ericfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ericfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericfs/subscriptions","organizations_url":"https://api.github.com/users/ericfs/orgs","repos_url":"https://api.github.com/users/ericfs/repos","events_url":"https://api.github.com/users/ericfs/events{/privacy}","received_events_url":"https://api.github.com/users/ericfs/received_events","type":"User","site_admin":false},"body":"I think this will drop query parameters in the AMP URL:\r\nhttp://www.example.com/foo?amp=true\r\nShould produce:\r\nhttps://cdn.ampproject.org/v/www.example.com/foo?amp=true&amp_js_v=0.1","created_at":"2017-06-14T20:25:44Z","updated_at":"2017-06-14T20:26:36Z","html_url":"https://github.com/ampproject/amp-viewer/pull/36#discussion_r122055050","pull_request_url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/comments/122055050"},"html":{"href":"https://github.com/ampproject/amp-viewer/pull/36#discussion_r122055050"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36","id":125200337,"html_url":"https://github.com/ampproject/amp-viewer/pull/36","diff_url":"https://github.com/ampproject/amp-viewer/pull/36.diff","patch_url":"https://github.com/ampproject/amp-viewer/pull/36.patch","issue_url":"https://api.github.com/repos/ampproject/amp-viewer/issues/36","number":36,"state":"open","locked":false,"title":"added fallback url functionality","user":{"login":"chenshay","id":1397465,"avatar_url":"https://avatars3.githubusercontent.com/u/1397465?v=3","gravatar_id":"","url":"https://api.github.com/users/chenshay","html_url":"https://github.com/chenshay","followers_url":"https://api.github.com/users/chenshay/followers","following_url":"https://api.github.com/users/chenshay/following{/other_user}","gists_url":"https://api.github.com/users/chenshay/gists{/gist_id}","starred_url":"https://api.github.com/users/chenshay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenshay/subscriptions","organizations_url":"https://api.github.com/users/chenshay/orgs","repos_url":"https://api.github.com/users/chenshay/repos","events_url":"https://api.github.com/users/chenshay/events{/privacy}","received_events_url":"https://api.github.com/users/chenshay/received_events","type":"User","site_admin":false},"body":"close #32 ","created_at":"2017-06-12T18:31:42Z","updated_at":"2017-06-14T20:26:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e027770206fb59041abf6b6ff6adbf82f9cb9b02","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lannka","id":8496897,"avatar_url":"https://avatars0.githubusercontent.com/u/8496897?v=3","gravatar_id":"","url":"https://api.github.com/users/lannka","html_url":"https://github.com/lannka","followers_url":"https://api.github.com/users/lannka/followers","following_url":"https://api.github.com/users/lannka/following{/other_user}","gists_url":"https://api.github.com/users/lannka/gists{/gist_id}","starred_url":"https://api.github.com/users/lannka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lannka/subscriptions","organizations_url":"https://api.github.com/users/lannka/orgs","repos_url":"https://api.github.com/users/lannka/repos","events_url":"https://api.github.com/users/lannka/events{/privacy}","received_events_url":"https://api.github.com/users/lannka/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36/commits","review_comments_url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36/comments","review_comment_url":"https://api.github.com/repos/ampproject/amp-viewer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amp-viewer/issues/36/comments","statuses_url":"https://api.github.com/repos/ampproject/amp-viewer/statuses/e423e180376266d507333a535b3ab4e7d60d24c8","head":{"label":"chenshay:url","ref":"url","sha":"e423e180376266d507333a535b3ab4e7d60d24c8","user":{"login":"chenshay","id":1397465,"avatar_url":"https://avatars3.githubusercontent.com/u/1397465?v=3","gravatar_id":"","url":"https://api.github.com/users/chenshay","html_url":"https://github.com/chenshay","followers_url":"https://api.github.com/users/chenshay/followers","following_url":"https://api.github.com/users/chenshay/following{/other_user}","gists_url":"https://api.github.com/users/chenshay/gists{/gist_id}","starred_url":"https://api.github.com/users/chenshay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenshay/subscriptions","organizations_url":"https://api.github.com/users/chenshay/orgs","repos_url":"https://api.github.com/users/chenshay/repos","events_url":"https://api.github.com/users/chenshay/events{/privacy}","received_events_url":"https://api.github.com/users/chenshay/received_events","type":"User","site_admin":false},"repo":{"id":92106257,"name":"amp-viewer","full_name":"chenshay/amp-viewer","owner":{"login":"chenshay","id":1397465,"avatar_url":"https://avatars3.githubusercontent.com/u/1397465?v=3","gravatar_id":"","url":"https://api.github.com/users/chenshay","html_url":"https://github.com/chenshay","followers_url":"https://api.github.com/users/chenshay/followers","following_url":"https://api.github.com/users/chenshay/following{/other_user}","gists_url":"https://api.github.com/users/chenshay/gists{/gist_id}","starred_url":"https://api.github.com/users/chenshay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenshay/subscriptions","organizations_url":"https://api.github.com/users/chenshay/orgs","repos_url":"https://api.github.com/users/chenshay/repos","events_url":"https://api.github.com/users/chenshay/events{/privacy}","received_events_url":"https://api.github.com/users/chenshay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chenshay/amp-viewer","description":null,"fork":true,"url":"https://api.github.com/repos/chenshay/amp-viewer","forks_url":"https://api.github.com/repos/chenshay/amp-viewer/forks","keys_url":"https://api.github.com/repos/chenshay/amp-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chenshay/amp-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chenshay/amp-viewer/teams","hooks_url":"https://api.github.com/repos/chenshay/amp-viewer/hooks","issue_events_url":"https://api.github.com/repos/chenshay/amp-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/chenshay/amp-viewer/events","assignees_url":"https://api.github.com/repos/chenshay/amp-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/chenshay/amp-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/chenshay/amp-viewer/tags","blobs_url":"https://api.github.com/repos/chenshay/amp-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chenshay/amp-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chenshay/amp-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/chenshay/amp-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chenshay/amp-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/chenshay/amp-viewer/languages","stargazers_url":"https://api.github.com/repos/chenshay/amp-viewer/stargazers","contributors_url":"https://api.github.com/repos/chenshay/amp-viewer/contributors","subscribers_url":"https://api.github.com/repos/chenshay/amp-viewer/subscribers","subscription_url":"https://api.github.com/repos/chenshay/amp-viewer/subscription","commits_url":"https://api.github.com/repos/chenshay/amp-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/chenshay/amp-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/chenshay/amp-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/chenshay/amp-viewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/chenshay/amp-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/chenshay/amp-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chenshay/amp-viewer/merges","archive_url":"https://api.github.com/repos/chenshay/amp-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chenshay/amp-viewer/downloads","issues_url":"https://api.github.com/repos/chenshay/amp-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/chenshay/amp-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/chenshay/amp-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/chenshay/amp-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chenshay/amp-viewer/labels{/name}","releases_url":"https://api.github.com/repos/chenshay/amp-viewer/releases{/id}","deployments_url":"https://api.github.com/repos/chenshay/amp-viewer/deployments","created_at":"2017-05-22T22:52:45Z","updated_at":"2017-05-24T15:50:12Z","pushed_at":"2017-06-14T20:05:02Z","git_url":"git://github.com/chenshay/amp-viewer.git","ssh_url":"git@github.com:chenshay/amp-viewer.git","clone_url":"https://github.com/chenshay/amp-viewer.git","svn_url":"https://github.com/chenshay/amp-viewer","homepage":null,"size":138,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ampproject:master","ref":"master","sha":"0b53a79b1f5e1118846108c05c9c6c3651fd7834","user":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars0.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":91111465,"name":"amp-viewer","full_name":"ampproject/amp-viewer","owner":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars0.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ampproject/amp-viewer","description":null,"fork":false,"url":"https://api.github.com/repos/ampproject/amp-viewer","forks_url":"https://api.github.com/repos/ampproject/amp-viewer/forks","keys_url":"https://api.github.com/repos/ampproject/amp-viewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amp-viewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amp-viewer/teams","hooks_url":"https://api.github.com/repos/ampproject/amp-viewer/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amp-viewer/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amp-viewer/events","assignees_url":"https://api.github.com/repos/ampproject/amp-viewer/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amp-viewer/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amp-viewer/tags","blobs_url":"https://api.github.com/repos/ampproject/amp-viewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amp-viewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amp-viewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amp-viewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amp-viewer/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amp-viewer/languages","stargazers_url":"https://api.github.com/repos/ampproject/amp-viewer/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amp-viewer/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amp-viewer/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amp-viewer/subscription","commits_url":"https://api.github.com/repos/ampproject/amp-viewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amp-viewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amp-viewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amp-viewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amp-viewer/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amp-viewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amp-viewer/merges","archive_url":"https://api.github.com/repos/ampproject/amp-viewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amp-viewer/downloads","issues_url":"https://api.github.com/repos/ampproject/amp-viewer/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amp-viewer/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amp-viewer/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amp-viewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amp-viewer/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amp-viewer/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amp-viewer/deployments","created_at":"2017-05-12T16:44:56Z","updated_at":"2017-06-13T23:00:27Z","pushed_at":"2017-06-14T20:05:04Z","git_url":"git://github.com/ampproject/amp-viewer.git","ssh_url":"git@github.com:ampproject/amp-viewer.git","clone_url":"https://github.com/ampproject/amp-viewer.git","svn_url":"https://github.com/ampproject/amp-viewer","homepage":null,"size":127,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":16,"forks":2,"open_issues":16,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36"},"html":{"href":"https://github.com/ampproject/amp-viewer/pull/36"},"issue":{"href":"https://api.github.com/repos/ampproject/amp-viewer/issues/36"},"comments":{"href":"https://api.github.com/repos/ampproject/amp-viewer/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amp-viewer/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amp-viewer/statuses/e423e180376266d507333a535b3ab4e7d60d24c8"}}}}
{"actor":{"display_login":"ericfs"}}