mirror of
https://github.com/bower/bower.git
synced 2026-02-11 22:44:58 -05:00
Improve content disposition regexp.
This commit is contained in:
@@ -141,8 +141,13 @@ UrlResolver.prototype._parseHeaders = function (file, response) {
|
||||
return Q.resolve([file, response]);
|
||||
}
|
||||
|
||||
// If so, extract the filename
|
||||
matches = disposition.match(/filename="?(.+?)"?/i);
|
||||
// If so, extract the filename from it
|
||||
// Since there's various security issues with parsing this header,
|
||||
// we only interpret word chars plus dots, dashes and spaces
|
||||
// Also the filename can't start with a space and end with a
|
||||
// dot or a space (this is known to cause issues in Windows)
|
||||
// See: http://superuser.com/questions/230385/dots-at-end-of-file-name
|
||||
matches = disposition.match(/filename="?([\w\.\-](?:[\w\.\- ]*[\w\-]))"?/i);
|
||||
if (!matches) {
|
||||
return Q.resolve([file, response]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user