Skip to content

egui_extras: percent-decode file:// URIs in the file loader - #8342

Open
Lfan-ke wants to merge 1 commit into
emilk:mainfrom
Lfan-ke:fix/file-loader-percent-decode
Open

egui_extras: percent-decode file:// URIs in the file loader#8342
Lfan-ke wants to merge 1 commit into
emilk:mainfrom
Lfan-ke:fix/file-loader-percent-decode

Conversation

@Lfan-ke

@Lfan-ke Lfan-ke commented Jul 25, 2026

Copy link
Copy Markdown

FileLoader strips the file:// prefix but does not percent-decode the path,
so a file:// URI with an escape such as %20 fails to resolve on disk (the
function's own doc noted "percent un-encoding are not handled").

convert_uri_to_path now decodes %XX escapes (e.g. %20 -> space) after
stripping the scheme, using a small inline decoder so no dependency is added.
Invalid or truncated escapes are left as-is, and UTF-8 multibyte sequences round
-trip. Added %20 cases to the existing check_convert_uri_to_path test for
both the Windows and non-Windows paths.

cargo test, clippy, and fmt pass for egui_extras.

Closes #8288

Signed-off-by: 林晨 (Leo Cheng) <leo-cheng@vip.qq.com>
@github-actions

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/8342-fix/file-loader-percent-decode

View snapshot changes at kitdiff

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.

Image/file loader has issues when file uri contains escaped spaces.

1 participant