{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip/pulls/comments/80336867","id":80336867,"diff_hunk":"@@ -71,5 +71,10 @@ def upload_file_backend(request, user_profile):\n     if ((settings.MAX_FILE_UPLOAD_SIZE * 1024 * 1024) < user_file._get_size()):\n         return json_error(_(\"File Upload is larger than allowed limit\"))\n \n+    if not isinstance(user_file.name, str):\n+        # This check makes sure that the type of the file name is not\n+        # Python 2 Unicode.\n+        user_file.name = user_file.name.encode('ascii')","path":"zerver/views/upload.py","position":7,"original_position":7,"commit_id":"6dc91ebffa1274b85f10d27246c5d96d08adc4ef","original_commit_id":"6dc91ebffa1274b85f10d27246c5d96d08adc4ef","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":"Can you expand this comment a bit more to explain why the new logic is correct?  I don't totally follow and I think it'll be especially unclear to future developers who didn't see the original issue.  In particular, it's not clear to me why the logic will be correct in Python 3 where `str` is `unicode`.","created_at":"2016-09-23T22:19:57Z","updated_at":"2016-09-23T22:20:14Z","html_url":"https://github.com/zulip/zulip/pull/1815#discussion_r80336867","pull_request_url":"https://api.github.com/repos/zulip/zulip/pulls/1815","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments/80336867"},"html":{"href":"https://github.com/zulip/zulip/pull/1815#discussion_r80336867"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1815"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/1815","id":85776917,"html_url":"https://github.com/zulip/zulip/pull/1815","diff_url":"https://github.com/zulip/zulip/pull/1815.diff","patch_url":"https://github.com/zulip/zulip/pull/1815.patch","issue_url":"https://api.github.com/repos/zulip/zulip/issues/1815","number":1815,"state":"open","locked":false,"title":"Url encoded name of the file should be an ascii.","user":{"login":"umairwaheed","id":641763,"avatar_url":"https://avatars.githubusercontent.com/u/641763?v=3","gravatar_id":"","url":"https://api.github.com/users/umairwaheed","html_url":"https://github.com/umairwaheed","followers_url":"https://api.github.com/users/umairwaheed/followers","following_url":"https://api.github.com/users/umairwaheed/following{/other_user}","gists_url":"https://api.github.com/users/umairwaheed/gists{/gist_id}","starred_url":"https://api.github.com/users/umairwaheed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umairwaheed/subscriptions","organizations_url":"https://api.github.com/users/umairwaheed/orgs","repos_url":"https://api.github.com/users/umairwaheed/repos","events_url":"https://api.github.com/users/umairwaheed/events{/privacy}","received_events_url":"https://api.github.com/users/umairwaheed/received_events","type":"User","site_admin":false},"body":"The url encoded name of the file should not be a unicode. This\r\nresults in an error when we later try to unquote it.\r\n\r\nFixes: #1803 \r\n\r\n@timabbott ","created_at":"2016-09-19T11:32:19Z","updated_at":"2016-09-23T22:20:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be151880e93f41311b51940e520a361e9ac99ae5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip/pulls/1815/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip/pulls/1815/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/1815/comments","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/6dc91ebffa1274b85f10d27246c5d96d08adc4ef","head":{"label":"umairwaheed:1803-broken-encoding","ref":"1803-broken-encoding","sha":"6dc91ebffa1274b85f10d27246c5d96d08adc4ef","user":{"login":"umairwaheed","id":641763,"avatar_url":"https://avatars.githubusercontent.com/u/641763?v=3","gravatar_id":"","url":"https://api.github.com/users/umairwaheed","html_url":"https://github.com/umairwaheed","followers_url":"https://api.github.com/users/umairwaheed/followers","following_url":"https://api.github.com/users/umairwaheed/following{/other_user}","gists_url":"https://api.github.com/users/umairwaheed/gists{/gist_id}","starred_url":"https://api.github.com/users/umairwaheed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umairwaheed/subscriptions","organizations_url":"https://api.github.com/users/umairwaheed/orgs","repos_url":"https://api.github.com/users/umairwaheed/repos","events_url":"https://api.github.com/users/umairwaheed/events{/privacy}","received_events_url":"https://api.github.com/users/umairwaheed/received_events","type":"User","site_admin":false},"repo":{"id":56792781,"name":"zulip","full_name":"umairwaheed/zulip","owner":{"login":"umairwaheed","id":641763,"avatar_url":"https://avatars.githubusercontent.com/u/641763?v=3","gravatar_id":"","url":"https://api.github.com/users/umairwaheed","html_url":"https://github.com/umairwaheed","followers_url":"https://api.github.com/users/umairwaheed/followers","following_url":"https://api.github.com/users/umairwaheed/following{/other_user}","gists_url":"https://api.github.com/users/umairwaheed/gists{/gist_id}","starred_url":"https://api.github.com/users/umairwaheed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umairwaheed/subscriptions","organizations_url":"https://api.github.com/users/umairwaheed/orgs","repos_url":"https://api.github.com/users/umairwaheed/repos","events_url":"https://api.github.com/users/umairwaheed/events{/privacy}","received_events_url":"https://api.github.com/users/umairwaheed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/umairwaheed/zulip","description":"Zulip server - powerful open source group chat","fork":true,"url":"https://api.github.com/repos/umairwaheed/zulip","forks_url":"https://api.github.com/repos/umairwaheed/zulip/forks","keys_url":"https://api.github.com/repos/umairwaheed/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/umairwaheed/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/umairwaheed/zulip/teams","hooks_url":"https://api.github.com/repos/umairwaheed/zulip/hooks","issue_events_url":"https://api.github.com/repos/umairwaheed/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/umairwaheed/zulip/events","assignees_url":"https://api.github.com/repos/umairwaheed/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/umairwaheed/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/umairwaheed/zulip/tags","blobs_url":"https://api.github.com/repos/umairwaheed/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/umairwaheed/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/umairwaheed/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/umairwaheed/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/umairwaheed/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/umairwaheed/zulip/languages","stargazers_url":"https://api.github.com/repos/umairwaheed/zulip/stargazers","contributors_url":"https://api.github.com/repos/umairwaheed/zulip/contributors","subscribers_url":"https://api.github.com/repos/umairwaheed/zulip/subscribers","subscription_url":"https://api.github.com/repos/umairwaheed/zulip/subscription","commits_url":"https://api.github.com/repos/umairwaheed/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/umairwaheed/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/umairwaheed/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/umairwaheed/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/umairwaheed/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/umairwaheed/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/umairwaheed/zulip/merges","archive_url":"https://api.github.com/repos/umairwaheed/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/umairwaheed/zulip/downloads","issues_url":"https://api.github.com/repos/umairwaheed/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/umairwaheed/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/umairwaheed/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/umairwaheed/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/umairwaheed/zulip/labels{/name}","releases_url":"https://api.github.com/repos/umairwaheed/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/umairwaheed/zulip/deployments","created_at":"2016-04-21T17:22:21Z","updated_at":"2016-06-27T06:01:26Z","pushed_at":"2016-09-23T11:14:33Z","git_url":"git://github.com/umairwaheed/zulip.git","ssh_url":"git@github.com:umairwaheed/zulip.git","clone_url":"https://github.com/umairwaheed/zulip.git","svn_url":"https://github.com/umairwaheed/zulip","homepage":"","size":115532,"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":"535a40ded9960f1633bed9e8b6820b98ca9a7429","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-09-23T06:04:33Z","pushed_at":"2016-09-23T21:52:37Z","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":123577,"stargazers_count":4102,"watchers_count":4102,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":709,"mirror_url":null,"open_issues_count":545,"forks":709,"open_issues":545,"watchers":4102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1815"},"html":{"href":"https://github.com/zulip/zulip/pull/1815"},"issue":{"href":"https://api.github.com/repos/zulip/zulip/issues/1815"},"comments":{"href":"https://api.github.com/repos/zulip/zulip/issues/1815/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1815/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip/pulls/1815/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip/statuses/6dc91ebffa1274b85f10d27246c5d96d08adc4ef"}}}}
{"actor":{"display_login":"timabbott"}}