Skip to content

fix: UTF-8 filename truncation#1272

Merged
andrinoff merged 1 commit into
floatpane:masterfrom
1108han-blip:codex/utf8-safe-filename-truncation
May 11, 2026
Merged

fix: UTF-8 filename truncation#1272
andrinoff merged 1 commit into
floatpane:masterfrom
1108han-blip:codex/utf8-safe-filename-truncation

Conversation

@1108han-blip
Copy link
Copy Markdown
Contributor

@1108han-blip 1108han-blip commented May 11, 2026

What?

  • Add UTF-8-safe truncation for sanitized attachment filenames
  • Preserve filename extensions while truncating the base name on valid rune boundaries
  • Add regression coverage for long CJK and emoji filenames

Why?

The previous byte-slicing logic could cut through a multi-byte UTF-8 sequence when shortening long attachment filenames, producing invalid UTF-8 for names containing CJK characters or emoji.

Fixes #1102.

@1108han-blip 1108han-blip requested a review from a team as a code owner May 11, 2026 10:09
@floatpanebot floatpanebot added the bug Something isn't working label May 11, 2026
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

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

Hi @1108han-blip! Please fix the following issues with your PR:

  • Title: Is too long (53 characters). The PR title must be strictly under 40 characters.

@1108han-blip 1108han-blip changed the title fix: truncate sanitized filenames on UTF-8 boundaries fix UTF-8 filename truncation May 11, 2026
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

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

Hi @1108han-blip! Please fix the following issues with your PR:

  • Title: Does not follow conventional commits (e.g., feat: added something, fix(core): resolved crash).

@1108han-blip 1108han-blip changed the title fix UTF-8 filename truncation fix: UTF-8 filename truncation May 11, 2026
@floatpanebot floatpanebot dismissed stale reviews from themself May 11, 2026 10:12

Formatting issues have been resolved. Thank you!

Copy link
Copy Markdown
Member

@andrinoff andrinoff left a comment

Choose a reason for hiding this comment

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

lgtm

@andrinoff andrinoff added the size/M Diff: 51–200 lines label May 11, 2026
@andrinoff andrinoff merged commit b858d58 into floatpane:master May 11, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size/M Diff: 51–200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: sanitizeFilename truncates by bytes, can produce invalid UTF-8

3 participants