-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
Hey there! Thanks for such a great tool!
It seems that there is a problem with filename* decoding for multipart data. Having the content-disposition header like that for a part "form-data; name=fileName; filename*=utf-8''1_%D0%9B%D0%B8%D1%81%D1%821.html" file callback provides incorrect filename.
I've been digging into it recently and noticed something odd.
Lines 151 to 159 in da0e67d
| if (header['content-disposition']) { | |
| parsed = parseParams(header['content-disposition'][0]); | |
| if (!RE_FIELD.test(parsed[0])) | |
| return skipPart(part); | |
| for (i = 0, len = parsed.length; i < len; ++i) { | |
| if (RE_NAME.test(parsed[i][0])) { | |
| fieldname = decodeText(parsed[i][1], 'binary', 'utf8'); | |
| } else if (RE_FILENAME.test(parsed[i][0])) { | |
| filename = decodeText(parsed[i][1], 'binary', 'utf8'); |
Lines 78 to 82 in da0e67d
| if (charset && tmp.length) { | |
| tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), | |
| 'binary', | |
| charset); | |
| } |
parseParams internally decodes filename into specified encoding, so parsed contains already decoded filename. On line 159 filename is decoded again having binary as current encoding and returns incorrect result.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels