{"action":"created","comment":{"url":"https://api.github.com/repos/scijs/get-pixels/pulls/comments/127541611","pull_request_review_id":50143950,"id":127541611,"diff_hunk":"@@ -117,7 +117,7 @@ module.exports = function getPixels(url, type, cb) {\n     cb = type\n     type = ''\n   }\n-  var ext = path.extname(url)\n+  var ext = path.extname(url.toString().split('?')[0])","path":"dom-pixels.js","position":5,"original_position":5,"commit_id":"c5b036efaf8bd1e6c79f24e639f87654271e8376","original_commit_id":"c5b036efaf8bd1e6c79f24e639f87654271e8376","user":{"login":"benwiley4000","id":13558253,"avatar_url":"https://avatars6.githubusercontent.com/u/13558253?v=4","gravatar_id":"","url":"https://api.github.com/users/benwiley4000","html_url":"https://github.com/benwiley4000","followers_url":"https://api.github.com/users/benwiley4000/followers","following_url":"https://api.github.com/users/benwiley4000/following{/other_user}","gists_url":"https://api.github.com/users/benwiley4000/gists{/gist_id}","starred_url":"https://api.github.com/users/benwiley4000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benwiley4000/subscriptions","organizations_url":"https://api.github.com/users/benwiley4000/orgs","repos_url":"https://api.github.com/users/benwiley4000/repos","events_url":"https://api.github.com/users/benwiley4000/events{/privacy}","received_events_url":"https://api.github.com/users/benwiley4000/received_events","type":"User","site_admin":false},"body":"It's not obvious to me what `url.toString()` would do if it's not already a String.\r\n\r\nI checked, and it looks like `path.extname(undefined)` creates an error in Node's `path` module (at least the current version), while it returns an empty string for `node-browserify` (the browserify built-in which gets included in bundles). That said, the previous line was already relying on non-standard behavior.\r\n\r\nWhat about:\r\n```js\r\nvar ext = url ? path.extname(url.split('?')[0]) : ''\r\n```\r\nor:\r\n```js\r\nvar ext = typeof url === 'string' ? path.extname(url.split('?')[0]) : ''\r\n```\r\n\r\n🙂 It's not obvious to me what `url.toString()` would do if it's not already a String.\r\n\r\nI checked, and it looks like `path.extname(undefined)` creates an error in Node's `path` module (at least the current version), while it returns an empty string for `node-browserify` (the browserify built-in which gets included in bundles). That said, the previous line was already relying on non-standard behavior.\r\n\r\nWhat about:\r\n```js\r\nvar ext = url ? path.extname(url.split('?')[0]) : ''\r\n```\r\nor:\r\n```js\r\nvar ext = typeof url === 'string' ? path.extname(url.split('?')[0]) : ''\r\n```\r\n\r\n🙂 ","created_at":"2017-07-14T20:26:30Z","updated_at":"2017-07-14T20:26:38Z","html_url":"https://github.com/scijs/get-pixels/pull/23#discussion_r127541611","pull_request_url":"https://api.github.com/repos/scijs/get-pixels/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/comments/127541611"},"html":{"href":"https://github.com/scijs/get-pixels/pull/23#discussion_r127541611"},"pull_request":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/scijs/get-pixels/pulls/23","id":34141025,"html_url":"https://github.com/scijs/get-pixels/pull/23","diff_url":"https://github.com/scijs/get-pixels/pull/23.diff","patch_url":"https://github.com/scijs/get-pixels/pull/23.patch","issue_url":"https://api.github.com/repos/scijs/get-pixels/issues/23","number":23,"state":"open","locked":false,"title":"Fixed #6","user":{"login":"59naga","id":1548478,"avatar_url":"https://avatars4.githubusercontent.com/u/1548478?v=4","gravatar_id":"","url":"https://api.github.com/users/59naga","html_url":"https://github.com/59naga","followers_url":"https://api.github.com/users/59naga/followers","following_url":"https://api.github.com/users/59naga/following{/other_user}","gists_url":"https://api.github.com/users/59naga/gists{/gist_id}","starred_url":"https://api.github.com/users/59naga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/59naga/subscriptions","organizations_url":"https://api.github.com/users/59naga/orgs","repos_url":"https://api.github.com/users/59naga/repos","events_url":"https://api.github.com/users/59naga/events{/privacy}","received_events_url":"https://api.github.com/users/59naga/received_events","type":"User","site_admin":false},"body":"Before\n\n``` js\ngetPixels('animated.gif?1430103876000',function(error,pixels){\n  console.log(pixels.shape.length===3)// true\n});\n```\n\nAfter\n\n``` js\ngetPixels('animated.gif?1430103876000',function(error,pixels){\n  console.log(pixels.shape.length===4)// true\n});\n```\n","created_at":"2015-04-27T05:45:38Z","updated_at":"2017-07-14T20:26:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"611fc9fbba36bd50812fdf07e3db6fb9ee6b4ff4","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/scijs/get-pixels/pulls/23/commits","review_comments_url":"https://api.github.com/repos/scijs/get-pixels/pulls/23/comments","review_comment_url":"https://api.github.com/repos/scijs/get-pixels/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scijs/get-pixels/issues/23/comments","statuses_url":"https://api.github.com/repos/scijs/get-pixels/statuses/c5b036efaf8bd1e6c79f24e639f87654271e8376","head":{"label":"59naga:master","ref":"master","sha":"c5b036efaf8bd1e6c79f24e639f87654271e8376","user":{"login":"59naga","id":1548478,"avatar_url":"https://avatars4.githubusercontent.com/u/1548478?v=4","gravatar_id":"","url":"https://api.github.com/users/59naga","html_url":"https://github.com/59naga","followers_url":"https://api.github.com/users/59naga/followers","following_url":"https://api.github.com/users/59naga/following{/other_user}","gists_url":"https://api.github.com/users/59naga/gists{/gist_id}","starred_url":"https://api.github.com/users/59naga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/59naga/subscriptions","organizations_url":"https://api.github.com/users/59naga/orgs","repos_url":"https://api.github.com/users/59naga/repos","events_url":"https://api.github.com/users/59naga/events{/privacy}","received_events_url":"https://api.github.com/users/59naga/received_events","type":"User","site_admin":false},"repo":{"id":34106873,"name":"get-pixels","full_name":"59naga/get-pixels","owner":{"login":"59naga","id":1548478,"avatar_url":"https://avatars4.githubusercontent.com/u/1548478?v=4","gravatar_id":"","url":"https://api.github.com/users/59naga","html_url":"https://github.com/59naga","followers_url":"https://api.github.com/users/59naga/followers","following_url":"https://api.github.com/users/59naga/following{/other_user}","gists_url":"https://api.github.com/users/59naga/gists{/gist_id}","starred_url":"https://api.github.com/users/59naga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/59naga/subscriptions","organizations_url":"https://api.github.com/users/59naga/orgs","repos_url":"https://api.github.com/users/59naga/repos","events_url":"https://api.github.com/users/59naga/events{/privacy}","received_events_url":"https://api.github.com/users/59naga/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/59naga/get-pixels","description":"Reads an image into an ndarray","fork":true,"url":"https://api.github.com/repos/59naga/get-pixels","forks_url":"https://api.github.com/repos/59naga/get-pixels/forks","keys_url":"https://api.github.com/repos/59naga/get-pixels/keys{/key_id}","collaborators_url":"https://api.github.com/repos/59naga/get-pixels/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/59naga/get-pixels/teams","hooks_url":"https://api.github.com/repos/59naga/get-pixels/hooks","issue_events_url":"https://api.github.com/repos/59naga/get-pixels/issues/events{/number}","events_url":"https://api.github.com/repos/59naga/get-pixels/events","assignees_url":"https://api.github.com/repos/59naga/get-pixels/assignees{/user}","branches_url":"https://api.github.com/repos/59naga/get-pixels/branches{/branch}","tags_url":"https://api.github.com/repos/59naga/get-pixels/tags","blobs_url":"https://api.github.com/repos/59naga/get-pixels/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/59naga/get-pixels/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/59naga/get-pixels/git/refs{/sha}","trees_url":"https://api.github.com/repos/59naga/get-pixels/git/trees{/sha}","statuses_url":"https://api.github.com/repos/59naga/get-pixels/statuses/{sha}","languages_url":"https://api.github.com/repos/59naga/get-pixels/languages","stargazers_url":"https://api.github.com/repos/59naga/get-pixels/stargazers","contributors_url":"https://api.github.com/repos/59naga/get-pixels/contributors","subscribers_url":"https://api.github.com/repos/59naga/get-pixels/subscribers","subscription_url":"https://api.github.com/repos/59naga/get-pixels/subscription","commits_url":"https://api.github.com/repos/59naga/get-pixels/commits{/sha}","git_commits_url":"https://api.github.com/repos/59naga/get-pixels/git/commits{/sha}","comments_url":"https://api.github.com/repos/59naga/get-pixels/comments{/number}","issue_comment_url":"https://api.github.com/repos/59naga/get-pixels/issues/comments{/number}","contents_url":"https://api.github.com/repos/59naga/get-pixels/contents/{+path}","compare_url":"https://api.github.com/repos/59naga/get-pixels/compare/{base}...{head}","merges_url":"https://api.github.com/repos/59naga/get-pixels/merges","archive_url":"https://api.github.com/repos/59naga/get-pixels/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/59naga/get-pixels/downloads","issues_url":"https://api.github.com/repos/59naga/get-pixels/issues{/number}","pulls_url":"https://api.github.com/repos/59naga/get-pixels/pulls{/number}","milestones_url":"https://api.github.com/repos/59naga/get-pixels/milestones{/number}","notifications_url":"https://api.github.com/repos/59naga/get-pixels/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/59naga/get-pixels/labels{/name}","releases_url":"https://api.github.com/repos/59naga/get-pixels/releases{/id}","deployments_url":"https://api.github.com/repos/59naga/get-pixels/deployments","created_at":"2015-04-17T09:02:00Z","updated_at":"2015-05-06T20:46:07Z","pushed_at":"2015-05-06T20:46:06Z","git_url":"git://github.com/59naga/get-pixels.git","ssh_url":"git@github.com:59naga/get-pixels.git","clone_url":"https://github.com/59naga/get-pixels.git","svn_url":"https://github.com/59naga/get-pixels","homepage":null,"size":598,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"scijs:master","ref":"master","sha":"cd8bf8871d19992628d41898876ed2081696a4af","user":{"login":"scijs","id":8939992,"avatar_url":"https://avatars5.githubusercontent.com/u/8939992?v=4","gravatar_id":"","url":"https://api.github.com/users/scijs","html_url":"https://github.com/scijs","followers_url":"https://api.github.com/users/scijs/followers","following_url":"https://api.github.com/users/scijs/following{/other_user}","gists_url":"https://api.github.com/users/scijs/gists{/gist_id}","starred_url":"https://api.github.com/users/scijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scijs/subscriptions","organizations_url":"https://api.github.com/users/scijs/orgs","repos_url":"https://api.github.com/users/scijs/repos","events_url":"https://api.github.com/users/scijs/events{/privacy}","received_events_url":"https://api.github.com/users/scijs/received_events","type":"Organization","site_admin":false},"repo":{"id":10065278,"name":"get-pixels","full_name":"scijs/get-pixels","owner":{"login":"scijs","id":8939992,"avatar_url":"https://avatars5.githubusercontent.com/u/8939992?v=4","gravatar_id":"","url":"https://api.github.com/users/scijs","html_url":"https://github.com/scijs","followers_url":"https://api.github.com/users/scijs/followers","following_url":"https://api.github.com/users/scijs/following{/other_user}","gists_url":"https://api.github.com/users/scijs/gists{/gist_id}","starred_url":"https://api.github.com/users/scijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scijs/subscriptions","organizations_url":"https://api.github.com/users/scijs/orgs","repos_url":"https://api.github.com/users/scijs/repos","events_url":"https://api.github.com/users/scijs/events{/privacy}","received_events_url":"https://api.github.com/users/scijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scijs/get-pixels","description":"Reads an image into an ndarray","fork":false,"url":"https://api.github.com/repos/scijs/get-pixels","forks_url":"https://api.github.com/repos/scijs/get-pixels/forks","keys_url":"https://api.github.com/repos/scijs/get-pixels/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scijs/get-pixels/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scijs/get-pixels/teams","hooks_url":"https://api.github.com/repos/scijs/get-pixels/hooks","issue_events_url":"https://api.github.com/repos/scijs/get-pixels/issues/events{/number}","events_url":"https://api.github.com/repos/scijs/get-pixels/events","assignees_url":"https://api.github.com/repos/scijs/get-pixels/assignees{/user}","branches_url":"https://api.github.com/repos/scijs/get-pixels/branches{/branch}","tags_url":"https://api.github.com/repos/scijs/get-pixels/tags","blobs_url":"https://api.github.com/repos/scijs/get-pixels/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scijs/get-pixels/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scijs/get-pixels/git/refs{/sha}","trees_url":"https://api.github.com/repos/scijs/get-pixels/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scijs/get-pixels/statuses/{sha}","languages_url":"https://api.github.com/repos/scijs/get-pixels/languages","stargazers_url":"https://api.github.com/repos/scijs/get-pixels/stargazers","contributors_url":"https://api.github.com/repos/scijs/get-pixels/contributors","subscribers_url":"https://api.github.com/repos/scijs/get-pixels/subscribers","subscription_url":"https://api.github.com/repos/scijs/get-pixels/subscription","commits_url":"https://api.github.com/repos/scijs/get-pixels/commits{/sha}","git_commits_url":"https://api.github.com/repos/scijs/get-pixels/git/commits{/sha}","comments_url":"https://api.github.com/repos/scijs/get-pixels/comments{/number}","issue_comment_url":"https://api.github.com/repos/scijs/get-pixels/issues/comments{/number}","contents_url":"https://api.github.com/repos/scijs/get-pixels/contents/{+path}","compare_url":"https://api.github.com/repos/scijs/get-pixels/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scijs/get-pixels/merges","archive_url":"https://api.github.com/repos/scijs/get-pixels/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scijs/get-pixels/downloads","issues_url":"https://api.github.com/repos/scijs/get-pixels/issues{/number}","pulls_url":"https://api.github.com/repos/scijs/get-pixels/pulls{/number}","milestones_url":"https://api.github.com/repos/scijs/get-pixels/milestones{/number}","notifications_url":"https://api.github.com/repos/scijs/get-pixels/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scijs/get-pixels/labels{/name}","releases_url":"https://api.github.com/repos/scijs/get-pixels/releases{/id}","deployments_url":"https://api.github.com/repos/scijs/get-pixels/deployments","created_at":"2013-05-14T21:26:35Z","updated_at":"2017-07-14T12:45:56Z","pushed_at":"2017-06-27T02:49:18Z","git_url":"git://github.com/scijs/get-pixels.git","ssh_url":"git@github.com:scijs/get-pixels.git","clone_url":"https://github.com/scijs/get-pixels.git","svn_url":"https://github.com/scijs/get-pixels","homepage":null,"size":509,"stargazers_count":160,"watchers_count":160,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":9,"forks":29,"open_issues":9,"watchers":160,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/23"},"html":{"href":"https://github.com/scijs/get-pixels/pull/23"},"issue":{"href":"https://api.github.com/repos/scijs/get-pixels/issues/23"},"comments":{"href":"https://api.github.com/repos/scijs/get-pixels/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scijs/get-pixels/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/scijs/get-pixels/statuses/c5b036efaf8bd1e6c79f24e639f87654271e8376"}}}}
{"actor":{"display_login":"benwiley4000"}}