{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip/pulls/comments/69788987","id":69788987,"diff_hunk":"@@ -232,12 +233,14 @@ def extract_and_upload_attachments(message, realm):\n         content_type = part.get_content_type()\n         filename = part.get_filename()\n         if filename:\n-            s3_url = upload_message_image(filename, content_type,\n-                                          part.get_payload(decode=True),\n-                                          user_profile,\n-                                          target_realm=realm)\n-            formatted_link = u\"[%s](%s)\" % (filename, s3_url)\n-            attachment_links.append(formatted_link)\n+            attachment = part.get_payload(decode=True)\n+            if isinstance(attachment, binary_type):\n+                s3_url = upload_message_image(filename, content_type,\n+                                              attachment,\n+                                              user_profile,\n+                                              target_realm=realm)\n+                formatted_link = u\"[%s](%s)\" % (filename, s3_url)\n+                attachment_links.append(formatted_link)","path":"zerver/lib/email_mirror.py","position":43,"original_position":39,"commit_id":"6a564c1da811db077eba7ecc548af04b8ad88e73","original_commit_id":"3af8a38c5bed099b97858855f87012f065a45e45","user":{"login":"timabbott","id":2746074,"avatar_url":"https://avatars.githubusercontent.com/u/2746074?v=3","gravatar_id":"","url":"https://api.github.com/users/timabbott","html_url":"https://github.com/timabbott","followers_url":"https://api.github.com/users/timabbott/followers","following_url":"https://api.github.com/users/timabbott/following{/other_user}","gists_url":"https://api.github.com/users/timabbott/gists{/gist_id}","starred_url":"https://api.github.com/users/timabbott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timabbott/subscriptions","organizations_url":"https://api.github.com/users/timabbott/orgs","repos_url":"https://api.github.com/users/timabbott/repos","events_url":"https://api.github.com/users/timabbott/events{/privacy}","received_events_url":"https://api.github.com/users/timabbott/received_events","type":"User","site_admin":false},"body":"I think this probably deserves at least an `else` clause logging an error.","created_at":"2016-07-06T18:48:27Z","updated_at":"2016-07-06T18:48:27Z","html_url":"https://github.com/zulip/zulip/pull/1172#discussion_r69788987","pull_request_url":"https://api.github.com/repos/zulip/zulip/pulls/1172","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments/69788987"},"html":{"href":"https://github.com/zulip/zulip/pull/1172#discussion_r69788987"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1172"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/1172","id":76194424,"html_url":"https://github.com/zulip/zulip/pull/1172","diff_url":"https://github.com/zulip/zulip/pull/1172.diff","patch_url":"https://github.com/zulip/zulip/pull/1172.patch","issue_url":"https://api.github.com/repos/zulip/zulip/issues/1172","number":1172,"state":"open","locked":false,"title":"Shrink mypy's python 3 exclude list","user":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-04T19:06:25Z","updated_at":"2016-07-06T18:48:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6aee83b7b5447d9960273285905bc00096413b8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip/pulls/1172/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip/pulls/1172/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/1172/comments","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/6a564c1da811db077eba7ecc548af04b8ad88e73","head":{"label":"sharmaeklavya2:shrink-mypy-exclude","ref":"shrink-mypy-exclude","sha":"6a564c1da811db077eba7ecc548af04b8ad88e73","user":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"repo":{"id":53124720,"name":"zulip","full_name":"sharmaeklavya2/zulip","owner":{"login":"sharmaeklavya2","id":3839472,"avatar_url":"https://avatars.githubusercontent.com/u/3839472?v=3","gravatar_id":"","url":"https://api.github.com/users/sharmaeklavya2","html_url":"https://github.com/sharmaeklavya2","followers_url":"https://api.github.com/users/sharmaeklavya2/followers","following_url":"https://api.github.com/users/sharmaeklavya2/following{/other_user}","gists_url":"https://api.github.com/users/sharmaeklavya2/gists{/gist_id}","starred_url":"https://api.github.com/users/sharmaeklavya2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharmaeklavya2/subscriptions","organizations_url":"https://api.github.com/users/sharmaeklavya2/orgs","repos_url":"https://api.github.com/users/sharmaeklavya2/repos","events_url":"https://api.github.com/users/sharmaeklavya2/events{/privacy}","received_events_url":"https://api.github.com/users/sharmaeklavya2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sharmaeklavya2/zulip","description":"Zulip server - powerful open source group chat","fork":true,"url":"https://api.github.com/repos/sharmaeklavya2/zulip","forks_url":"https://api.github.com/repos/sharmaeklavya2/zulip/forks","keys_url":"https://api.github.com/repos/sharmaeklavya2/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sharmaeklavya2/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sharmaeklavya2/zulip/teams","hooks_url":"https://api.github.com/repos/sharmaeklavya2/zulip/hooks","issue_events_url":"https://api.github.com/repos/sharmaeklavya2/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/sharmaeklavya2/zulip/events","assignees_url":"https://api.github.com/repos/sharmaeklavya2/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/sharmaeklavya2/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/sharmaeklavya2/zulip/tags","blobs_url":"https://api.github.com/repos/sharmaeklavya2/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sharmaeklavya2/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sharmaeklavya2/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/sharmaeklavya2/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sharmaeklavya2/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/sharmaeklavya2/zulip/languages","stargazers_url":"https://api.github.com/repos/sharmaeklavya2/zulip/stargazers","contributors_url":"https://api.github.com/repos/sharmaeklavya2/zulip/contributors","subscribers_url":"https://api.github.com/repos/sharmaeklavya2/zulip/subscribers","subscription_url":"https://api.github.com/repos/sharmaeklavya2/zulip/subscription","commits_url":"https://api.github.com/repos/sharmaeklavya2/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/sharmaeklavya2/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/sharmaeklavya2/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/sharmaeklavya2/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/sharmaeklavya2/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/sharmaeklavya2/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sharmaeklavya2/zulip/merges","archive_url":"https://api.github.com/repos/sharmaeklavya2/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sharmaeklavya2/zulip/downloads","issues_url":"https://api.github.com/repos/sharmaeklavya2/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/sharmaeklavya2/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/sharmaeklavya2/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/sharmaeklavya2/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sharmaeklavya2/zulip/labels{/name}","releases_url":"https://api.github.com/repos/sharmaeklavya2/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/sharmaeklavya2/zulip/deployments","created_at":"2016-03-04T09:41:46Z","updated_at":"2016-03-04T09:41:49Z","pushed_at":"2016-07-05T04:21:57Z","git_url":"git://github.com/sharmaeklavya2/zulip.git","ssh_url":"git@github.com:sharmaeklavya2/zulip.git","clone_url":"https://github.com/sharmaeklavya2/zulip.git","svn_url":"https://github.com/sharmaeklavya2/zulip","homepage":"","size":112262,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"zulip:master","ref":"master","sha":"ce1676e21985efc565fcd4a813c7e08f57ffc6e5","user":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"repo":{"id":43160685,"name":"zulip","full_name":"zulip/zulip","owner":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zulip/zulip","description":"Zulip server - powerful open source group chat","fork":false,"url":"https://api.github.com/repos/zulip/zulip","forks_url":"https://api.github.com/repos/zulip/zulip/forks","keys_url":"https://api.github.com/repos/zulip/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zulip/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zulip/zulip/teams","hooks_url":"https://api.github.com/repos/zulip/zulip/hooks","issue_events_url":"https://api.github.com/repos/zulip/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/zulip/zulip/events","assignees_url":"https://api.github.com/repos/zulip/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/zulip/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/zulip/zulip/tags","blobs_url":"https://api.github.com/repos/zulip/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zulip/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zulip/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/zulip/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/zulip/zulip/languages","stargazers_url":"https://api.github.com/repos/zulip/zulip/stargazers","contributors_url":"https://api.github.com/repos/zulip/zulip/contributors","subscribers_url":"https://api.github.com/repos/zulip/zulip/subscribers","subscription_url":"https://api.github.com/repos/zulip/zulip/subscription","commits_url":"https://api.github.com/repos/zulip/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/zulip/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/zulip/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/zulip/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/zulip/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/zulip/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zulip/zulip/merges","archive_url":"https://api.github.com/repos/zulip/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zulip/zulip/downloads","issues_url":"https://api.github.com/repos/zulip/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/zulip/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/zulip/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/zulip/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zulip/zulip/labels{/name}","releases_url":"https://api.github.com/repos/zulip/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/zulip/zulip/deployments","created_at":"2015-09-25T16:37:25Z","updated_at":"2016-07-06T14:08:34Z","pushed_at":"2016-07-06T18:41:13Z","git_url":"git://github.com/zulip/zulip.git","ssh_url":"git@github.com:zulip/zulip.git","clone_url":"https://github.com/zulip/zulip.git","svn_url":"https://github.com/zulip/zulip","homepage":"","size":118473,"stargazers_count":3907,"watchers_count":3907,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":613,"mirror_url":null,"open_issues_count":372,"forks":613,"open_issues":372,"watchers":3907,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1172"},"html":{"href":"https://github.com/zulip/zulip/pull/1172"},"issue":{"href":"https://api.github.com/repos/zulip/zulip/issues/1172"},"comments":{"href":"https://api.github.com/repos/zulip/zulip/issues/1172/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1172/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1172/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip/statuses/6a564c1da811db077eba7ecc548af04b8ad88e73"}}}}
{"actor":{"display_login":"timabbott"}}