freesoftwarefactory / parse-multipart

A javascript/nodejs multipart/form-data parser which operates on raw data.
MIT License
48 stars 79 forks source link

TypeError: Cannot read property 'split' of undefined when header missing filename #10

Open kajann opened 6 years ago

kajann commented 6 years ago

Content-Disposition is missing the filename, which is optional, so it must be handled properly --4ef20bdd-c5ba-482d-a7e9-8b06be43a9e1 content-disposition: form-data; name="data" Content-Type: image/png Content-Length: 221417

yosephmi commented 2 years ago

having a similar issue, although i am missing the "name" attribute of the "content-disposition" Was this ever resolved?

TomTom0815 commented 1 year ago

I can confirm this bug. (it hits me right now, very badly) I pass a file and a key-value pair through a HTML form and this library throws an TypeError

Exception has occurred: TypeError: Cannot read properties of undefined (reading 'split')

Here is what happens: The process function (line 20) expects a header sting that consists of 3 parts seperated by a semicolon. This leads to a function call of obj function with a undefined as str value - when parsing the key-value (and not the file)