From 1a32483cf715fce1e3bd0a9493ee7fd584d4168d Mon Sep 17 00:00:00 2001 From: sled Date: Tue, 26 Jul 2011 17:52:40 +0300 Subject: [PATCH] Allows (escaped) double quotes and semicolons in the filename. --- lib/incoming_form.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/incoming_form.js b/lib/incoming_form.js index 62c9e3bc..584e0389 100644 --- a/lib/incoming_form.js +++ b/lib/incoming_form.js @@ -278,7 +278,8 @@ IncomingForm.prototype._initMultipart = function(boundary) { part.name = m[1]; } - if (m = headerValue.match(/filename="([^;]+)"/i)) { + if (m = headerValue.match(/filename="([^"\\]*(?:\\.[^"\\]*)*)"/i)) { + m[1] = m[1].replace(/\\"/ig, '"'); part.filename = m[1].substr(m[1].lastIndexOf('\\') + 1); } } else if (headerField == 'content-type') {