Skip to content

🔤 fix: Encode Unicode Filenames in Project File Uploads - #17878

Open
berry-13 wants to merge 2 commits into
devfrom
berry-13/bug-fix-for-unicode-filenames
Open

berry-13 wants to merge 2 commits into
devfrom
berry-13/bug-fix-for-unicode-filenames

Conversation

@berry-13

@berry-13 berry-13 commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Uploading a file from the Projects files pane garbles any filename outside ASCII: Описание.md is stored as ÐпиÑание.md, and the RAG API and the file row both receive the broken name. A name with a stray percent sign such as 100% done.md is rejected with a 400, and a name containing a valid escape such as a%20b.md is silently rewritten.

The upload route decodes every filename with decodeURIComponent, and multer reads a raw multipart filename as latin1, so the client has to percent-encode the name. Chat uploads do since #12977; this upload never did. It now sends the encoded name, so these files keep their names. Files already stored with a garbled name stay that way until they are uploaded again.

Related to #17733

Type of change

  • Bug fix

Testing

Tested environments/configuration:

  • Real multer 2.5.0 with the route's decode step, posting raw and encoded names through Node's fetch.

Automated tests:

  • ProjectResources.spec.tsx: added a case each for Cyrillic, Japanese, 100% done.md and a%20b.md. All four failed before the fix; the full spec now passes 18 of 18.
  • project-files-ui.spec.ts: added scenarios that check the stored name after a reload for a non-Latin name and a percent-sign name. Both, plus the existing association retry scenario, passed in desktop light, desktop dark and mobile.

Screenshots / recordings

No layout change: the file row shows the correct filename instead of a garbled one.

Risk / compatibility

None. Plain ASCII names encode to themselves, and the server already decodes this form for chat uploads.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required documentation PR: N/A

Project uploads sent the raw filename, which multer reads as latin1 and the upload route then decodes with decodeURIComponent. Non-ASCII names were garbled, a stray percent sign failed with a 400, and a valid escape such as %20 was silently rewritten. Percent-encode the name the same way chat uploads do.
@berry-13 berry-13 added 🐛 bug Something isn't working 🔧 fix Bug fixes and code patches labels Nov 7, 2026
Copilot AI balanced review requested due to automatic review settings November 7, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@berry-13
berry-13 marked this pull request as ready for review November 7, 2026 00:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T00:10:10.416391Z e7eb90f Draft marked ready
🔒 Security Review ✅ Completed 2026-11-07T00:13:02.015180Z e7eb90f Draft marked ready
ℹ️ 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working 🔧 fix Bug fixes and code patches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants