{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/dxr/pulls/comments/42813750","id":42813750,"diff_hunk":"@@ -4,17 +4,18 @@\n def icon(path):\n     \"\"\"Return the basename (no extension) of the icon file to use for a path.\"\"\"\n     root, ext = splitext(path)\n-    return ext_map.get(ext[1:], 'unknown')\n+    return ext_map.get(ext[1:].lower(), 'unknown')\n \n \n def is_text(data):\n     # Simple stupid test that apparently works rather well :)\n     return '\\0' not in data\n \n+\n def is_image(path):\n     \"\"\"Determine whether the path is an image.\"\"\"","path":"dxr/mime.py","position":14,"original_position":14,"commit_id":"f36c41e961ab411da8cb0e4d59f6b9257ee17a5c","original_commit_id":"f36c41e961ab411da8cb0e4d59f6b9257ee17a5c","user":{"login":"erikrose","id":295816,"avatar_url":"https://avatars.githubusercontent.com/u/295816?v=3","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"body":"For example, we might have `is_image()` and `is_image_with_indexable_text()` and just call those from various points below rather than hard-coding 'svg' specifically. Then we make the meaning super-clear at all the callsites and, as a bonus, have a hook for any other image-but-text formats that crop up.","created_at":"2015-10-22T22:18:49Z","updated_at":"2015-10-22T22:18:49Z","html_url":"https://github.com/mozilla/dxr/pull/472#discussion_r42813750","pull_request_url":"https://api.github.com/repos/mozilla/dxr/pulls/472","_links":{"self":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/comments/42813750"},"html":{"href":"https://github.com/mozilla/dxr/pull/472#discussion_r42813750"},"pull_request":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/472"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/dxr/pulls/472","id":48355876,"html_url":"https://github.com/mozilla/dxr/pull/472","diff_url":"https://github.com/mozilla/dxr/pull/472.diff","patch_url":"https://github.com/mozilla/dxr/pull/472.patch","issue_url":"https://api.github.com/repos/mozilla/dxr/issues/472","number":472,"state":"open","locked":false,"title":"Display SVGs as XML, and add link to view as image.","user":{"login":"pelmers","id":2406051,"avatar_url":"https://avatars.githubusercontent.com/u/2406051?v=3","gravatar_id":"","url":"https://api.github.com/users/pelmers","html_url":"https://github.com/pelmers","followers_url":"https://api.github.com/users/pelmers/followers","following_url":"https://api.github.com/users/pelmers/following{/other_user}","gists_url":"https://api.github.com/users/pelmers/gists{/gist_id}","starred_url":"https://api.github.com/users/pelmers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pelmers/subscriptions","organizations_url":"https://api.github.com/users/pelmers/orgs","repos_url":"https://api.github.com/users/pelmers/repos","events_url":"https://api.github.com/users/pelmers/events{/privacy}","received_events_url":"https://api.github.com/users/pelmers/received_events","type":"User","site_admin":false},"body":"Fixes bug 1202598. https://bugzilla.mozilla.org/show_bug.cgi?id=1202598\r\n\r\nAlso normalize extension to lowercase when looking up in the extension map, so that .svg and .SVG are treated the same.","created_at":"2015-10-21T16:32:59Z","updated_at":"2015-10-22T22:18:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40d444a2c1ecd2218013847bf687c8b16b9af7f8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/dxr/pulls/472/commits","review_comments_url":"https://api.github.com/repos/mozilla/dxr/pulls/472/comments","review_comment_url":"https://api.github.com/repos/mozilla/dxr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/dxr/issues/472/comments","statuses_url":"https://api.github.com/repos/mozilla/dxr/statuses/f36c41e961ab411da8cb0e4d59f6b9257ee17a5c","head":{"label":"pelmers:svg_1202598","ref":"svg_1202598","sha":"f36c41e961ab411da8cb0e4d59f6b9257ee17a5c","user":{"login":"pelmers","id":2406051,"avatar_url":"https://avatars.githubusercontent.com/u/2406051?v=3","gravatar_id":"","url":"https://api.github.com/users/pelmers","html_url":"https://github.com/pelmers","followers_url":"https://api.github.com/users/pelmers/followers","following_url":"https://api.github.com/users/pelmers/following{/other_user}","gists_url":"https://api.github.com/users/pelmers/gists{/gist_id}","starred_url":"https://api.github.com/users/pelmers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pelmers/subscriptions","organizations_url":"https://api.github.com/users/pelmers/orgs","repos_url":"https://api.github.com/users/pelmers/repos","events_url":"https://api.github.com/users/pelmers/events{/privacy}","received_events_url":"https://api.github.com/users/pelmers/received_events","type":"User","site_admin":false},"repo":{"id":15886083,"name":"dxr","full_name":"pelmers/dxr","owner":{"login":"pelmers","id":2406051,"avatar_url":"https://avatars.githubusercontent.com/u/2406051?v=3","gravatar_id":"","url":"https://api.github.com/users/pelmers","html_url":"https://github.com/pelmers","followers_url":"https://api.github.com/users/pelmers/followers","following_url":"https://api.github.com/users/pelmers/following{/other_user}","gists_url":"https://api.github.com/users/pelmers/gists{/gist_id}","starred_url":"https://api.github.com/users/pelmers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pelmers/subscriptions","organizations_url":"https://api.github.com/users/pelmers/orgs","repos_url":"https://api.github.com/users/pelmers/repos","events_url":"https://api.github.com/users/pelmers/events{/privacy}","received_events_url":"https://api.github.com/users/pelmers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pelmers/dxr","description":"An intelligent source code browser","fork":true,"url":"https://api.github.com/repos/pelmers/dxr","forks_url":"https://api.github.com/repos/pelmers/dxr/forks","keys_url":"https://api.github.com/repos/pelmers/dxr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pelmers/dxr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pelmers/dxr/teams","hooks_url":"https://api.github.com/repos/pelmers/dxr/hooks","issue_events_url":"https://api.github.com/repos/pelmers/dxr/issues/events{/number}","events_url":"https://api.github.com/repos/pelmers/dxr/events","assignees_url":"https://api.github.com/repos/pelmers/dxr/assignees{/user}","branches_url":"https://api.github.com/repos/pelmers/dxr/branches{/branch}","tags_url":"https://api.github.com/repos/pelmers/dxr/tags","blobs_url":"https://api.github.com/repos/pelmers/dxr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pelmers/dxr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pelmers/dxr/git/refs{/sha}","trees_url":"https://api.github.com/repos/pelmers/dxr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pelmers/dxr/statuses/{sha}","languages_url":"https://api.github.com/repos/pelmers/dxr/languages","stargazers_url":"https://api.github.com/repos/pelmers/dxr/stargazers","contributors_url":"https://api.github.com/repos/pelmers/dxr/contributors","subscribers_url":"https://api.github.com/repos/pelmers/dxr/subscribers","subscription_url":"https://api.github.com/repos/pelmers/dxr/subscription","commits_url":"https://api.github.com/repos/pelmers/dxr/commits{/sha}","git_commits_url":"https://api.github.com/repos/pelmers/dxr/git/commits{/sha}","comments_url":"https://api.github.com/repos/pelmers/dxr/comments{/number}","issue_comment_url":"https://api.github.com/repos/pelmers/dxr/issues/comments{/number}","contents_url":"https://api.github.com/repos/pelmers/dxr/contents/{+path}","compare_url":"https://api.github.com/repos/pelmers/dxr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pelmers/dxr/merges","archive_url":"https://api.github.com/repos/pelmers/dxr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pelmers/dxr/downloads","issues_url":"https://api.github.com/repos/pelmers/dxr/issues{/number}","pulls_url":"https://api.github.com/repos/pelmers/dxr/pulls{/number}","milestones_url":"https://api.github.com/repos/pelmers/dxr/milestones{/number}","notifications_url":"https://api.github.com/repos/pelmers/dxr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pelmers/dxr/labels{/name}","releases_url":"https://api.github.com/repos/pelmers/dxr/releases{/id}","created_at":"2014-01-13T23:50:59Z","updated_at":"2015-01-02T15:41:27Z","pushed_at":"2015-10-22T20:29:37Z","git_url":"git://github.com/pelmers/dxr.git","ssh_url":"git@github.com:pelmers/dxr.git","clone_url":"https://github.com/pelmers/dxr.git","svn_url":"https://github.com/pelmers/dxr","homepage":"","size":11440,"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":"mozilla:master","ref":"master","sha":"ab22e9743a5b2e74291b6d504e3490979cd57d8d","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1795049,"name":"dxr","full_name":"mozilla/dxr","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/dxr","description":"An intelligent source code browser","fork":false,"url":"https://api.github.com/repos/mozilla/dxr","forks_url":"https://api.github.com/repos/mozilla/dxr/forks","keys_url":"https://api.github.com/repos/mozilla/dxr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/dxr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/dxr/teams","hooks_url":"https://api.github.com/repos/mozilla/dxr/hooks","issue_events_url":"https://api.github.com/repos/mozilla/dxr/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/dxr/events","assignees_url":"https://api.github.com/repos/mozilla/dxr/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/dxr/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/dxr/tags","blobs_url":"https://api.github.com/repos/mozilla/dxr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/dxr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/dxr/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/dxr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/dxr/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/dxr/languages","stargazers_url":"https://api.github.com/repos/mozilla/dxr/stargazers","contributors_url":"https://api.github.com/repos/mozilla/dxr/contributors","subscribers_url":"https://api.github.com/repos/mozilla/dxr/subscribers","subscription_url":"https://api.github.com/repos/mozilla/dxr/subscription","commits_url":"https://api.github.com/repos/mozilla/dxr/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/dxr/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/dxr/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/dxr/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/dxr/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/dxr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/dxr/merges","archive_url":"https://api.github.com/repos/mozilla/dxr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/dxr/downloads","issues_url":"https://api.github.com/repos/mozilla/dxr/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/dxr/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/dxr/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/dxr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/dxr/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/dxr/releases{/id}","created_at":"2011-05-24T18:52:38Z","updated_at":"2015-10-22T04:22:31Z","pushed_at":"2015-10-21T16:32:59Z","git_url":"git://github.com/mozilla/dxr.git","ssh_url":"git@github.com:mozilla/dxr.git","clone_url":"https://github.com/mozilla/dxr.git","svn_url":"https://github.com/mozilla/dxr","homepage":"https://dxr.readthedocs.org/","size":15231,"stargazers_count":352,"watchers_count":352,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":134,"mirror_url":null,"open_issues_count":29,"forks":134,"open_issues":29,"watchers":352,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/472"},"html":{"href":"https://github.com/mozilla/dxr/pull/472"},"issue":{"href":"https://api.github.com/repos/mozilla/dxr/issues/472"},"comments":{"href":"https://api.github.com/repos/mozilla/dxr/issues/472/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/472/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/dxr/pulls/472/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/dxr/statuses/f36c41e961ab411da8cb0e4d59f6b9257ee17a5c"}}}}