freesoftwarefactory / parse-multipart

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

Parser crashes on simple form fields included in formData #6

Open rcfrias opened 7 years ago

rcfrias commented 7 years ago

While testing the parser, I noticed that sending data other than files causes the script to crash while processing each part.

so adding fields to the formData like this:

formData.append('name', product.name);
formData.append('uploadFile', file, file.name);

Would cause an error like this:

var k = str.split('=');
        ^
TypeError: Cannot read property 'split' of undefined

To fix this issue, additional condition for non-file data must be included in the parser process logic.

christiansalazar commented 7 years ago

maybe it is the same issue as https://github.com/freesoftwarefactory/parse-multipart/issues/4, a new branch provides a solution. can u check if your case is the same as this one ? (link)

El 17 ago. 2017 1:34 PM, "Roberto Frias" notifications@github.com escribió:

While testing the parser, I noticed that sending data other than files causes the script to crash while processing each part.

so adding fields to the formData like this:

formData.append('name', product.name); formData.append('uploadFile', file, file.name);

Would cause an error like this:

var k = str.split('='); ^ TypeError: Cannot read property 'split' of undefined

To fix this issue, additional condition for non-file data must be included in the parser process logic.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/freesoftwarefactory/parse-multipart/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/ABk4g941Z-H_b7TlWtWnCWEgFDRXbLtmks5sZGtWgaJpZM4O6gv2 .