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:
ScreenTinker 2026-05-12 11:57:54 -05:00
parent d679ca8d14
commit 766f02ae5d

View file

@ -41,9 +41,12 @@ const fileFilter = (req, file, cb) => {
}
};
// `defParamCharset: 'utf8'` makes busboy decode multipart filename headers as UTF-8.
// Default is latin1, which mangles umlauts and other non-ASCII characters
// (e.g. "Größe.jpg" arrives as "Größe.jpg" and gets stored that way).
// `defParamCharset: 'utf8'` only takes effect for RFC 5987 encoded
// `filename*=utf-8''...` params. Most real clients (browsers, curl, programmatic
// 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({
storage,
fileFilter,