From 1c81280d10bd85c46d0ef17e25d3780aa15c856b Mon Sep 17 00:00:00 2001 From: sanyam-vinay <36029030+sanyam-vinay@users.noreply.github.com> Date: Thu, 1 Feb 2018 13:10:16 +0530 Subject: [PATCH] Enable support of having only Content-id header field Current implementation assumes that the there are more tuples in the header, but in my multipart/related response there is only one which is Content-id, so removing the expectation of having more tuples. --- multipart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipart.js b/multipart.js index 1efecfe..d30a9a3 100644 --- a/multipart.js +++ b/multipart.js @@ -34,7 +34,7 @@ exports.Parse = function(multipartBodyBuffer,boundary){ return o; } var header = part.header.split(';'); - var file = obj(header[2]); + var file = (header.length >= 2) ? obj(header[2]): {}; var contentType = part.info.split(':')[1].trim(); Object.defineProperty( file , 'type' , { value: contentType, writable: true, enumerable: true, configurable: true })