8000 fix(folders): avoid utf-8 panic when inferring namespace by Elliot-32 · Pull Request #409 · hyprlab/hylki · GitHub
[go: up one dir, main page]

Skip to content

fix(folders): avoid utf-8 panic when inferring namespace - #409

Closed
Elliot-32 wants to merge 1 commit into
hyprlab:mainfrom
Elliot-32:fix/utf8-folder-namespace
Closed

Elliot-32 wants to merge 1 commit into
hyprlab:mainfrom
Elliot-32:fix/utf8-folder-namespace

Conversation

@Elliot-32
Copy link
Copy Markdown
Contributor

Problem

Hylki 1.43.1 crashes on startup when a custom folder path has a multibyte character crossing byte offset 6. folder_namespace() slices at root.len() after checking only the byte length. A synthetic path such as abcd摘要 reproduces end byte index 6 is not a char boundary.

Change

Use str::get() for the prefix check, preserving ASCII case-insensitive matching. Extract namespace inference into a helper so the regression test exercises production logic without initializing GTK. Cover UTF-8 boundaries, INBOX prefixes and delimiters, mixed folders, short paths, and empty inputs.

Validation

  • cargo test --locked folder_namespace_handles_utf8_paths: passed.
  • cargo build --locked: passed in the GNOME 50 SDK with the installed Flatpak libraries.
  • Regression harness using the extracted helper and test fails with the original slice and passes with the fix.
  • Built from main at 33080d3 and launched in the existing Flatpak environment on CachyOS/niri: account loaded, window opened, no UTF-8 panic. The original 1.43.1 install reproduces the crash.

hyprlab added a commit that referenced this pull request Oct 11, 2026
The prefix check sliced a folder path at a byte offset that could fall inside a multibyte character and crash at startup.

Co-Authored-By: Elliot <115418645+Elliot-32@users.noreply.github.com>
hyprlab added a commit that referenced this pull request Oct 11, 2026
LDAP directories use the encryption chosen for them (#307), the number keys tag the right message (#416), 40 more strings are translatable (#419), the #409 startup fix, and Catalan and French translations.
@hyprlab
hyprlab commented Oct 11, 2026
Copy link
Copy Markdown
Owner

Agentic reply:

Your fix is in the 1.44.0-beta.4 release (x86_64 only), as you submitted it. Please test it there and report anything that doesn't look right. It reaches the stable channel with the next stable release.

The beta build is in the repo now: flatpak update picks it up.

@hyprlab hyprlab closed this Oct 11, 2026
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

0