formidable
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -297,4 +297,4 @@ if (global.GENTLY) require = GENTLY.hijack(require); | ||
var filename = self._fileName(headerValue); | ||
if (filename) { | ||
part.filename = filename; | ||
if (filename !== undefined) { | ||
part.filename = filename || part.name; | ||
} | ||
@@ -330,3 +330,3 @@ } else if (headerField == 'content-type') { | ||
IncomingForm.prototype._fileName = function(headerValue) { | ||
var m = headerValue.match(/filename="(.+?)"($|; )/i) | ||
var m = headerValue.match(/filename="(.*?)"($|; )/i) | ||
if (!m) return; | ||
@@ -333,0 +333,0 @@ |
@@ -52,2 +52,9 @@ var Buffer = require('buffer').Buffer, | ||
MultipartParser.stateToString = function(stateNumber) { | ||
for (var state in S) { | ||
var number = S[state]; | ||
if (number === stateNumber) return state; | ||
} | ||
}; | ||
MultipartParser.prototype.initWithBoundary = function(str) { | ||
@@ -300,4 +307,8 @@ this.boundary = new Buffer(str.length+4); | ||
if (this.state != S.END) { | ||
return new Error('MultipartParser.end(): stream ended unexpectedly'); | ||
return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain()); | ||
} | ||
}; | ||
MultipartParser.prototype.explain = function() { | ||
return 'state = ' + MultipartParser.stateToString(this.state); | ||
}; |
{ | ||
"name": "formidable", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"dependencies": {}, | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
@@ -23,2 +23,11 @@ # Formidable | ||
### v1.0.5 | ||
* Support filename="" in multipart parts | ||
* Explain unexpected end() errors in parser better | ||
### v1.0.4 | ||
* Detect a good default tmp directory regardless of plattform. (#88) | ||
### v1.0.3 | ||
@@ -25,0 +34,0 @@ |
@@ -43,3 +43,3 @@ var common = require('../common'); | ||
(function testError() { | ||
assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly'); | ||
assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain()); | ||
})(); | ||
@@ -46,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 7 instances in 1 package
2884045
78
1950
276
31