mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3796] [Issue]: Cyrillic (non-Latin) NPC names fail avatar upload with 400 "Invalid character name" #2048
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2048
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Kuroame15 on GitHub (Jul 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3796
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Uploading an NPC avatar fails for any character whose name contains no Latin letters (Cyrillic, etc.) with 400 "Invalid character name". The Present Characters tracker accepts these names fine, but avatar upload rejects them.
Expected behavior
The avatar uploads successfully regardless of the character's name script, just as the tracker already accepts non-Latin names.
Actual behavior
The upload returns 400 { error: "Invalid character name" } and the image is never saved.
Steps to reproduce
Environment
Logs, screenshots, or video
Request: POST /api/avatars/npc/{chatId}
Body: { name: "Корвин", avatar: "data:image/jpeg;base64,..." }
Response: 400 { error: "Invalid character name" }
Additional context
Cause is in packages/server/src/routes/avatars.routes.ts, POST /npc/:chatId:
The [^a-z0-9] class turns every Cyrillic character into "-", the trailing replace strips them, safeName becomes "", and the handler returns 400 before the image is ever checked.
Suggested one-line fix — make the class Unicode-aware:
Alternatively, hash the name for the on-disk filename to keep it ASCII-safe, since avatars are already served by internal id.
Workaround: temporarily rename the NPC to Latin, upload, then rename back — the avatar sticks by internal id.
Template check
@SpicyMarinara commented on GitHub (Jul 18, 2026):
Claimed in draft PR #3800 on branch
agent/issue-sweep-2026-07-19.@SpicyMarinara commented on GitHub (Jul 18, 2026):
Addressed in #3800. NPC avatar upload and lookup now reuse a Unicode-aware slug helper across upload, chat, generation, and Game routes; Cyrillic upload/lookup is covered by E2E and final CI is green.