multiparty
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -0,1 +1,5 @@ | ||
### 3.2.2 | ||
* fix error on empty payloads (thanks [dougwilson]) | ||
### 3.2.1 | ||
@@ -2,0 +6,0 @@ |
34
index.js
@@ -23,3 +23,4 @@ exports.Form = Form; | ||
, PART_END = 10 | ||
, END = 11 | ||
, CLOSE_BOUNDARY = 11 | ||
, END = 12 | ||
@@ -184,3 +185,7 @@ , LF = 10 | ||
case START_BOUNDARY: | ||
if (index === boundaryLength - 2) { | ||
if (index === boundaryLength - 2 && c == HYPHEN) { | ||
index = 1; | ||
state = CLOSE_BOUNDARY; | ||
break; | ||
} else if (index === boundaryLength - 2) { | ||
if (c !== CR) return self.handleError(new Error("Expected CR Received " + c)); | ||
@@ -290,4 +295,5 @@ index++; | ||
} else if (c === HYPHEN) { | ||
// HYPHEN = end boundary | ||
self.lastBoundaryFlag = true; | ||
index = 1; | ||
state = CLOSE_BOUNDARY; | ||
break; | ||
} else { | ||
@@ -306,10 +312,2 @@ index = 0; | ||
} | ||
} else if (self.lastBoundaryFlag) { | ||
if (c === HYPHEN) { | ||
self.onParsePartEnd(); | ||
self.end(); | ||
state = END; | ||
} else { | ||
index = 0; | ||
} | ||
} else { | ||
@@ -337,2 +335,13 @@ index = 0; | ||
break; | ||
case CLOSE_BOUNDARY: | ||
if (c !== HYPHEN) return self.handleError(new Error("Expected HYPHEN Received " + c)); | ||
if (index === 1) { | ||
self.onParsePartEnd(); | ||
self.end(); | ||
state = END; | ||
} else if (index > 1) { | ||
return self.handleError(new Error("Parser has invalid state.")); | ||
} | ||
index++; | ||
break; | ||
case END: | ||
@@ -608,3 +617,2 @@ break; | ||
self.partBoundaryFlag = false; | ||
self.lastBoundaryFlag = false; | ||
@@ -611,0 +619,0 @@ self.on('finish', function() { |
{ | ||
"name": "multiparty", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "multipart/form-data parser which supports streaming", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36850
579