Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #6 #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fixed #6 #23

wants to merge 3 commits into from

Conversation

59naga
Copy link
Contributor

@59naga 59naga commented Apr 27, 2015

Before

getPixels('animated.gif?1430103876000',function(error,pixels){
  console.log(pixels.shape.length===3)// true
});

After

getPixels('animated.gif?1430103876000',function(error,pixels){
  console.log(pixels.shape.length===4)// true
});

Fixes #6.

Copy link
Collaborator

@benwiley4000 benwiley4000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore

GitHub and I are not getting along today...

Copy link
Collaborator

@benwiley4000 benwiley4000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me but I'm just hesitant about the way we handle non-String url values. Would love to see it merged ASAP! 😄

Also sorry, the review looked weird the first time so I re-posted. 👀

@@ -117,7 +117,7 @@ module.exports = function getPixels(url, type, cb) {
cb = type
type = ''
}
var ext = path.extname(url)
var ext = path.extname(url.toString().split('?')[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not obvious to me what url.toString() would do if it's not already a String.

I 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.

What about:

var ext = url ? path.extname(url.split('?')[0]) : ''

or:

var ext = typeof url === 'string' ? path.extname(url.split('?')[0]) : ''

🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support query string parameters in URLs
2 participants