From b1bb8c567f02d040fe6d796a60be639e2705a497 Mon Sep 17 00:00:00 2001 From: chottokun Date: Sat, 29 Aug 2026 09:03:58 +0900 Subject: [PATCH] fix(codeapi): add UTF-8 charset defaults to busboy in upload routes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /upload and /upload/batch endpoints in router.ts construct busboy without specifying defCharset or defParamCharset. Busboy defaults to Latin-1 (ISO-8859-1) for multipart parameter decoding, which causes non-ASCII filenames (e.g. Japanese characters) to be garbled. file-server.ts already sets defCharset: 'utf8' and defParamCharset: 'utf8' (lines 336-337), but router.ts was missing the same options — an asymmetry that surfaces as mojibake when uploading files with non-ASCII names through the API gateway. Add both options to the two busboy() calls in router.ts for consistency with file-server.ts. --- service/src/service/router.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/src/service/router.ts b/service/src/service/router.ts index f355c2d..8db70b0 100644 --- a/service/src/service/router.ts +++ b/service/src/service/router.ts @@ -365,6 +365,8 @@ router.post('/upload', uploadLimiter, async (req: t.AuthenticatedRequest, res: R const bb = busboy({ headers: req.headers, limits: { fileSize: planFileSize }, + defCharset: 'utf8', + defParamCharset: 'utf8', preservePath: true, }); @@ -575,6 +577,8 @@ router.post('/upload/batch', uploadLimiter, async (req: t.AuthenticatedRequest, const bb = busboy({ headers: req.headers, limits: { fileSize: planFileSize, files: MAX_BATCH_FILES }, + defCharset: 'utf8', + defParamCharset: 'utf8', preservePath: true, });