-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Issue with UTF-8 characters in filename #1104
Comments
The small test provided returned the expected filename with [email protected], and changed with [email protected]. |
Same problem after update from 1.4.4 on 1.4.5-lts.1 |
Multer has nothing to do with it, Busboy has changed something. This solved my problem: file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8') |
Multer has something to do about this, since it definitely changed behavior in an arguably incompatible way in what looks like a patch revision. What to do however I'm not sure; either way would be fine (interpreting the utf-8 to be consistent with previous behavior or passing the raw string to not make assumptions about encoding), but I believe this kind of change in a patch is troublesome to users. |
God bless you. I've managed to make a bodge in my app
because in my case |
HI, I faced same issue with the filename in Korean. I found out that the issue is relevant to "busboy', especially config property of "defParanCharset." The default value of that property is 'latin1', which means some parameters like non-latin filename in input-form is misdecoded on nodejs side without proper configuration. However, in the "multer" we don't have option to change the config properties of busboy. I hope the line 28 in '/lib/make-middleware.js' will be changed such as: At least, some way to configure busboy through multer module would be required. |
This issue is still relevant. Multer should not deviate from utf-8 default. An multer option should be created so that we can influence busboy |
I published a multer-utf8 package on npm that read files as utf8 charset by default. |
The problem still exists, please fix it quickly |
Just to clarify, in Multer 1.4.4 the name was parsed as utf-8, and in Multer 1.4.5-lts.1 it's parsed as latin1? In that case it seems straight forward to add |
multer({
storage,
defParamCharset: 'utf8',
defCharset: 'utf8',
})
|
why the default Postman is right? |
Postman uses “filename*”, so filename problems do not occur. see #1104 (comment)
|
where can I use filename* |
Is this solved ? I still got this issue and |
This is definitely NOT fixed! For TWO years now!! |
There is an open PR fixing all UTF8 issues in headers - #1210 |
[Client] formData.append('fileName', encodeURI(dto.file.name)) call axios.post(....) [Backend] it works |
That is not an option when sending an actual form, which I assume is a common case. |
Hi,
I found recently that something changed regarding the handling of filename containing utf-8 characters; they seem to be passed as-is, which was not the case before.
After investigating a bit I could reproduce the issue with the minimal code in https://github.com/CleyFaye/test-multer
I found that the browser side just pass the name as-is in the "filename" part of the header.
I've seen another issue related to using "filename*", but there is two problem with that: the browser's formdata does not use this, and RFC7578 actually says it should not be used.
What would be the proper way to handle this? Obviously it is possible, server side, to convert the content of
originalname
by putting all characters as bytes in an array then interpreting it as an utf-8 string (it does work), but since I never had this issue with older versions, I suspect something changed in the way multer handles this.The text was updated successfully, but these errors were encountered: