mirror of
https://github.com/screentinker/screentinker.git
synced 2026-05-15 07:32:23 -06:00
docs(upload): correct misleading defParamCharset comment
The previous comment claimed defParamCharset:'utf8' fixed multipart
filename header decoding. It doesn't - that option only fires for the
RFC 5987 encoded filename*=utf-8''... form, which clients rarely send.
The actual UTF-8 recovery happens in the storage.filename callback
(added in d679ca8) via Buffer.from(name,'latin1').toString('utf8').
The option is kept set for the rare RFC 5987 case but the comment no
longer overclaims what it does.
This commit is contained in:
parent
d679ca8d14
commit
766f02ae5d
|
|
@ -41,9 +41,12 @@ const fileFilter = (req, file, cb) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// `defParamCharset: 'utf8'` makes busboy decode multipart filename headers as UTF-8.
|
// `defParamCharset: 'utf8'` only takes effect for RFC 5987 encoded
|
||||||
// Default is latin1, which mangles umlauts and other non-ASCII characters
|
// `filename*=utf-8''...` params. Most real clients (browsers, curl, programmatic
|
||||||
// (e.g. "Größe.jpg" arrives as "Größe.jpg" and gets stored that way).
|
// HTTP) send the plain `filename="..."` form, where busboy still reads the bytes
|
||||||
|
// as latin1 regardless of this option. The actual UTF-8 recovery happens in the
|
||||||
|
// storage.filename callback above via Buffer.from(name,'latin1').toString('utf8').
|
||||||
|
// Kept here as defense-in-depth for the rare RFC 5987 case.
|
||||||
const upload = multer({
|
const upload = multer({
|
||||||
storage,
|
storage,
|
||||||
fileFilter,
|
fileFilter,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue