multiparty
Advanced tools
Comparing version 3.2.2 to 3.2.3
20
index.js
@@ -34,3 +34,4 @@ exports.Form = Form; | ||
var CONTENT_TYPE_RE = /^multipart\/(form-data|related);\s*boundary=(?:"([^"]+)"|([^;]+))$/i; | ||
var CONTENT_TYPE_RE = /^multipart\/(?:form-data|related)(?:;|$)/i; | ||
var CONTENT_TYPE_PARAM_RE = /;\s*(\S+)=(?:"([^"]+)"|([^;]+))/gi; | ||
var FILE_EXT_RE = /(\.[_\-a-zA-Z0-9]{0,16}).*/; | ||
@@ -103,3 +104,3 @@ var LAST_BOUNDARY_SUFFIX_LEN = 4; // --\r\n | ||
var m = contentType.match(CONTENT_TYPE_RE); | ||
var m = CONTENT_TYPE_RE.exec(contentType); | ||
if (!m) { | ||
@@ -109,3 +110,16 @@ handleError(new Error('unrecognized content-type: ' + contentType)); | ||
} | ||
var boundary = m[2] || m[3]; | ||
var boundary; | ||
CONTENT_TYPE_PARAM_RE.lastIndex = m.index + m[0].length - 1; | ||
while ((m = CONTENT_TYPE_PARAM_RE.exec(contentType))) { | ||
if (m[1].toLowerCase() !== 'boundary') continue; | ||
boundary = m[2] || m[3]; | ||
break; | ||
} | ||
if (!boundary) { | ||
handleError(new Error('content-type missing boundary: ' + require('util').inspect(m))); | ||
return; | ||
} | ||
setUpParser(self, boundary); | ||
@@ -112,0 +126,0 @@ req.pipe(self); |
{ | ||
"name": "multiparty", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"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
37221
590