{"action":"created","comment":{"url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/comments/210002049","pull_request_review_id":146124318,"id":210002049,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDAwMjA0OQ==","diff_hunk":"@@ -41,21 +42,37 @@ const fetchImageAsBase64 = url => {\n };\n \n const fetchOpenGraphData = url => {\n-  const isHtmlContentTypePromise = new Promise(resolve => {\n-    const headerRequest = request.head(url);\n-    headerRequest.on('response', response => {\n-      const isHtmlContentType =\n-        response.headers['content-type'] && response.headers['content-type'].match(/.*text\\/html/);\n-      resolve(isHtmlContentType);\n+  const CONTENT_TYPE_LIMIT = 1e7; // 10MB\n+  const parsedUrl = urlUtil.parse(url);\n+  const normalizedUrl = parsedUrl.protocol ? parsedUrl : urlUtil.parse(`http://${url}`);","path":"electron/js/lib/openGraph.js","position":23,"original_position":23,"commit_id":"1665ac3e3532b788de9d5c5e8fe49bbaf9efb27c","original_commit_id":"1665ac3e3532b788de9d5c5e8fe49bbaf9efb27c","user":{"login":"pwnsdx","id":2057765,"node_id":"MDQ6VXNlcjIwNTc3NjU=","avatar_url":"https://avatars3.githubusercontent.com/u/2057765?v=4","gravatar_id":"","url":"https://api.github.com/users/pwnsdx","html_url":"https://github.com/pwnsdx","followers_url":"https://api.github.com/users/pwnsdx/followers","following_url":"https://api.github.com/users/pwnsdx/following{/other_user}","gists_url":"https://api.github.com/users/pwnsdx/gists{/gist_id}","starred_url":"https://api.github.com/users/pwnsdx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwnsdx/subscriptions","organizations_url":"https://api.github.com/users/pwnsdx/orgs","repos_url":"https://api.github.com/users/pwnsdx/repos","events_url":"https://api.github.com/users/pwnsdx/events{/privacy}","received_events_url":"https://api.github.com/users/pwnsdx/received_events","type":"User","site_admin":false},"body":"Request should not happen if no protocol are set.","created_at":"2018-08-14T15:41:53Z","updated_at":"2018-08-14T15:42:31Z","html_url":"https://github.com/wireapp/wire-desktop/pull/1671#discussion_r210002049","pull_request_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/comments/210002049"},"html":{"href":"https://github.com/wireapp/wire-desktop/pull/1671#discussion_r210002049"},"pull_request":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671"}}},"pull_request":{"url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671","id":208315982,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4MzE1OTgy","html_url":"https://github.com/wireapp/wire-desktop/pull/1671","diff_url":"https://github.com/wireapp/wire-desktop/pull/1671.diff","patch_url":"https://github.com/wireapp/wire-desktop/pull/1671.patch","issue_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/1671","number":1671,"state":"open","locked":false,"title":"fix: limit content length size when downloading link preview (WEBAPP-4422, WEBAPP-5341)","user":{"login":"atomrc","id":1090716,"node_id":"MDQ6VXNlcjEwOTA3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/1090716?v=4","gravatar_id":"","url":"https://api.github.com/users/atomrc","html_url":"https://github.com/atomrc","followers_url":"https://api.github.com/users/atomrc/followers","following_url":"https://api.github.com/users/atomrc/following{/other_user}","gists_url":"https://api.github.com/users/atomrc/gists{/gist_id}","starred_url":"https://api.github.com/users/atomrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomrc/subscriptions","organizations_url":"https://api.github.com/users/atomrc/orgs","repos_url":"https://api.github.com/users/atomrc/repos","events_url":"https://api.github.com/users/atomrc/events{/privacy}","received_events_url":"https://api.github.com/users/atomrc/received_events","type":"User","site_admin":false},"body":"Previous strategy was:\r\n\r\n- do HEAD request and read the content of the response ;\r\n- if the content type doesn't match throw error ;\r\n- else send another request via `openGraph`.\r\n\r\nNew strategy:\r\n\r\n- do full request ;\r\n- when the headers arrive (before any content is downloaded), check `content-type` and `content-length` ;\r\n- if they are valid start counting downloaded bytes ;\r\n- if the number of bytes exceed the limit, we fail ;\r\n- if not we call the `parse` method of `openGraph`.","created_at":"2018-08-14T15:11:31Z","updated_at":"2018-08-14T15:42:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60f1bfddafe70844322dae37353949792758c7b4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671/commits","review_comments_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671/comments","review_comment_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/1671/comments","statuses_url":"https://api.github.com/repos/wireapp/wire-desktop/statuses/1665ac3e3532b788de9d5c5e8fe49bbaf9efb27c","head":{"label":"wireapp:fix/open_graph_size_limit","ref":"fix/open_graph_size_limit","sha":"1665ac3e3532b788de9d5c5e8fe49bbaf9efb27c","user":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":64225407,"node_id":"MDEwOlJlcG9zaXRvcnk2NDIyNTQwNw==","name":"wire-desktop","full_name":"wireapp/wire-desktop","owner":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wireapp/wire-desktop","description":":computer: Wire for desktop","fork":false,"url":"https://api.github.com/repos/wireapp/wire-desktop","forks_url":"https://api.github.com/repos/wireapp/wire-desktop/forks","keys_url":"https://api.github.com/repos/wireapp/wire-desktop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-desktop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-desktop/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-desktop/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-desktop/events","assignees_url":"https://api.github.com/repos/wireapp/wire-desktop/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-desktop/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-desktop/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-desktop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-desktop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-desktop/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-desktop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-desktop/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-desktop/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-desktop/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-desktop/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-desktop/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-desktop/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-desktop/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-desktop/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-desktop/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-desktop/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-desktop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-desktop/merges","archive_url":"https://api.github.com/repos/wireapp/wire-desktop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-desktop/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-desktop/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-desktop/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-desktop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-desktop/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-desktop/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-desktop/deployments","created_at":"2016-07-26T13:55:48Z","updated_at":"2018-08-14T12:13:41Z","pushed_at":"2018-08-14T15:11:31Z","git_url":"git://github.com/wireapp/wire-desktop.git","ssh_url":"git@github.com:wireapp/wire-desktop.git","clone_url":"https://github.com/wireapp/wire-desktop.git","svn_url":"https://github.com/wireapp/wire-desktop","homepage":"https://wire.com/download/","size":3683,"stargazers_count":698,"watchers_count":698,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":145,"mirror_url":null,"archived":false,"open_issues_count":65,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":145,"open_issues":65,"watchers":698,"default_branch":"master"}},"base":{"label":"wireapp:master","ref":"master","sha":"bd483d2c321ad97e47b969e9c31d5277981b0554","user":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":64225407,"node_id":"MDEwOlJlcG9zaXRvcnk2NDIyNTQwNw==","name":"wire-desktop","full_name":"wireapp/wire-desktop","owner":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wireapp/wire-desktop","description":":computer: Wire for desktop","fork":false,"url":"https://api.github.com/repos/wireapp/wire-desktop","forks_url":"https://api.github.com/repos/wireapp/wire-desktop/forks","keys_url":"https://api.github.com/repos/wireapp/wire-desktop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-desktop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-desktop/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-desktop/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-desktop/events","assignees_url":"https://api.github.com/repos/wireapp/wire-desktop/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-desktop/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-desktop/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-desktop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-desktop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-desktop/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-desktop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-desktop/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-desktop/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-desktop/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-desktop/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-desktop/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-desktop/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-desktop/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-desktop/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-desktop/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-desktop/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-desktop/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-desktop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-desktop/merges","archive_url":"https://api.github.com/repos/wireapp/wire-desktop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-desktop/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-desktop/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-desktop/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-desktop/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-desktop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-desktop/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-desktop/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-desktop/deployments","created_at":"2016-07-26T13:55:48Z","updated_at":"2018-08-14T12:13:41Z","pushed_at":"2018-08-14T15:11:31Z","git_url":"git://github.com/wireapp/wire-desktop.git","ssh_url":"git@github.com:wireapp/wire-desktop.git","clone_url":"https://github.com/wireapp/wire-desktop.git","svn_url":"https://github.com/wireapp/wire-desktop","homepage":"https://wire.com/download/","size":3683,"stargazers_count":698,"watchers_count":698,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":145,"mirror_url":null,"archived":false,"open_issues_count":65,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":145,"open_issues":65,"watchers":698,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671"},"html":{"href":"https://github.com/wireapp/wire-desktop/pull/1671"},"issue":{"href":"https://api.github.com/repos/wireapp/wire-desktop/issues/1671"},"comments":{"href":"https://api.github.com/repos/wireapp/wire-desktop/issues/1671/comments"},"review_comments":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671/comments"},"review_comment":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wireapp/wire-desktop/pulls/1671/commits"},"statuses":{"href":"https://api.github.com/repos/wireapp/wire-desktop/statuses/1665ac3e3532b788de9d5c5e8fe49bbaf9efb27c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pwnsdx"}}