-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
originalname was decoded incorrectly, when using postman to upload a file that filename is chinese #247
Comments
using curl and browser upload file,without:
there is no wrong! |
Same issue with russian language.
Decoding result on backend (fastify-multipart):
|
This will be resolved in |
the newest version is also has this problem . neither postman or in normal form post. i do this work.
because in the source code, the chunk is convert with latin1 |
@cczw2010 Can you provide the raw multipart form data that reproduces the issue? |
form direct submit without ajax 。but i can not see the Content-Disposition: or form data .
Talend APi (like postman)
|
For that form, it makes sense as there is no encoded version (in the style of RFC 8187) of the filename field being sent. So you'd have to use the workaround for re-decoding it as utf8 (although you don't need iconv for that as node has built-in support for utf8: What I could do though is add a default parameter charset config option specifically for multipart that would allow configuring which charset to use when parsing non-RFC8187-encoded parameters in part headers. |
Thanks for the answer, i'd cheked the string first before the changed version. |
if all chars are latin1, then re-decoding if (!/[^\u0000-\u00ff]/.test(file.originalname)) {
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8')
} |
here is request and response
The text was updated successfully, but these errors were encountered: