fix(storage): default defParamCharset to utf8 in the upload factory

This commit is contained in:
jubnl
2026-08-16 09:53:25 +02:00
parent b72645272b
commit f9d84f5907
2 changed files with 6 additions and 4 deletions
@@ -36,7 +36,7 @@ export interface StorageUploadOptions {
* the pre-factory call sites).
*/
filename?: (req: Request, file: Express.Multer.File) => string;
/** Parity-phase opt-in (files + collab pass 'utf8'). */
/** Always 'utf8' since fix #3; the option remains for explicit callers. */
defParamCharset?: 'utf8';
}
@@ -63,6 +63,8 @@ export function buildStorageUploadOptions(storage: StorageService, opts: Storage
}),
limits: { fileSize: opts.maxSize },
...(opts.fileFilter ? { fileFilter: opts.fileFilter } : {}),
...(opts.defParamCharset ? { defParamCharset: opts.defParamCharset } : {}),
// Uniform since fix #3: non-ASCII original filenames decode as UTF-8 on
// every upload route (previously only trip files + collab opted in).
defParamCharset: opts.defParamCharset ?? 'utf8',
};
}