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

Parse content-type and content-disposition to guess the asset type #454

Merged
merged 16 commits into from
May 13, 2013

Conversation

satazor
Copy link
Member

@satazor satazor commented May 6, 2013

This is an improvement over #431 since it also parses the content-type header.
Please review it. Before merging I will rebase it / or use pulley.

@davidmaxwaterman
Copy link
Contributor

I tested this with my projects and it works as expected.

@davidmaxwaterman
Copy link
Contributor

what needs to happen for this to be merged? if someone can tell me, I can try to make it happen (since I seem to be the only one that cares :)).

@davidmaxwaterman
Copy link
Contributor

anything I can do here?

@@ -461,8 +461,44 @@ Package.prototype.download = function () {
return this.emit('error', new Error(res.statusCode + ' status code for ' + this.assetUrl));
}

var file = fs.createWriteStream(path.join((this.path = tmpPath), 'index' + this.assetType));
// Detect correct asset type based on response headers
Copy link
Member

Choose a reason for hiding this comment

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

This chunk of code does quite a lot of stuff that has a distinct purpose. It should be a separate function that takes res.headers as an argument and returns the assetType.

@wibblymat
Copy link
Member

@davidmaxwaterman it needs reviewing by two other core contributors. If you are desperate for the feature you could try using this branch directly rather than waiting for a release that includes it.

@davidmaxwaterman
Copy link
Contributor

@wibblymat I have used the branch directly...that is the problem...I have submitted code to my project that depends on it, and it is taking longer to merge it in than I thought it would. It's only a matter of time before someone tries to build my project and finds it doesn't build properly, and then complains to me :/ I put a dependency on >0.9.3, but there is no such version...yet.

Max Waterman and others added 2 commits May 10, 2013 17:18
@satazor
Copy link
Member Author

satazor commented May 13, 2013

@wibblymat @sindresorhus @necolas Can we ship this? I will use puley or rebase.

else next();
if (this.assetType === '.zip' || this.assetType === '.tar') return this.once('extract', next).extract();

if (this.assetType === '.gz') this.emit('warn', 'gz package type not yet supported');
Copy link
Member

Choose a reason for hiding this comment

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

Were we going to move this check elsewhere? It seems to make sense here, I just vaguely remember the discussion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's fine to do it there.

@wibblymat
Copy link
Member

Added a comment about the (.tar).gz warning but other than that, LGTM.

@satazor
Copy link
Member Author

satazor commented May 13, 2013

@wibblymat you added the warning (can't see your commit), or you wanted to say that we should add it?

@satazor
Copy link
Member Author

satazor commented May 13, 2013

Oh nvm, when you said "added a comment" you mean that you added a comment here on github lol, I thought it was on the actual code.

satazor added a commit that referenced this pull request May 13, 2013
Parse content-type and content-disposition to guess the asset type
@satazor satazor merged commit f1a533e into master May 13, 2013
@satazor satazor mentioned this pull request May 13, 2013
satazor pushed a commit that referenced this pull request May 13, 2013
wibblymat pushed a commit to wibblymat/bower that referenced this pull request May 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants