Decode upload filenames from latin1 to UTF-8

A self-maintained patch by Mor1arty fixes the upload pipeline's character-encoding assumption, so files with Chinese (and other non-ASCII) filenames no longer arrive with garbled names on the server side.

intakei18n

The upstream codebase relies on multer, which inherits Busboy's latin1 default when parsing the multipart filename header. That default is fine for ASCII, but breaks on multi-byte encodings - Chinese characters come through mangled before the file ever reaches any processing logic.

The fix lands in backend/src/lib/upload.ts: after multer resolves without error, the middleware now re-decodes req.file.originalname using Buffer.from(name, "latin1").toString("utf-8"). It's 10 lines added, one removed. The change only fires on the success branch and only when originalname is present.

Mor1arty opened and merged this within four minutes. The context - a CN-locale deployment uploading Chinese-language documents - makes the failure obvious and the fix unambiguous.

So what Worth pulling in if you expect uploads from any non-Latin locale. The change is contained, low-risk, and fixes a latent bug in the upstream default that will bite anyone running the app for non-ASCII users.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from Mor1arty/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
9a3e93bf fix: support uploading file who involves Chinese content Moriarty 2026-05-15 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-447.md from inside the repo you want the changes in.

⬇ Download capture-thread-447.md