Skip to content

fix(codeapi): add UTF-8 charset defaults to busboy in upload routes - #65

Merged
danny-avila merged 1 commit into
LibreChat-AI:mainfrom
chottokun:fix/utf8-charset-busboy-upload
Sep 2, 2026
Merged

fix(codeapi): add UTF-8 charset defaults to busboy in upload routes#65
danny-avila merged 1 commit into
LibreChat-AI:mainfrom
chottokun:fix/utf8-charset-busboy-upload

Conversation

@chottokun

Copy link
Copy Markdown
Contributor

Problem

Non-ASCII filenames (e.g. Japanese characters like 日本語テスト.md) uploaded
through the /upload and /upload/batch endpoints are garbled because
busboy defaults to Latin-1 (ISO-8859-1) for parameter charset decoding.

For example, 日本語 becomes 日本語.

Root Cause

The file-server.ts already sets defCharset: 'utf8' and
defParamCharset: 'utf8' when constructing busboy (line 336-337), but
the same options are missing from the two busboy() calls in router.ts:

This asymmetry causes filenames to be correctly decoded in the file-server
path but garbled in the API gateway upload path.

Fix

Add defCharset: 'utf8' and defParamCharset: 'utf8' to both busboy()
calls in router.ts, consistent with the existing file-server.ts configuration.

Testing

Verified by uploading files with Japanese filenames (e.g. Github_Code_Reviewer_日本語_-saved.md)
through the /upload endpoint and confirming the filename is correctly preserved without garbling.

Changes

  • service/src/service/router.ts: Added defCharset: 'utf8' and defParamCharset: 'utf8' to 2 busboy constructor calls

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.
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: b1bb8c567f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T02:17:43.360986Z b1bb8c5 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danny-avila
danny-avila merged commit 45449ee into LibreChat-AI:main Sep 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants