Image/file loader has issues when file uri contains escaped spaces.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in crates/egui_extras/src/loaders/file_loader.rs at the linked line and reproduce loading a Windows file:// URI containing an escaped space such as %20. Confirm the loader resolves the URI to the intended file path and that the image loads successfully instead of failing to find the file.
Written by the indexing model from the issue text.
Description
Describe the bug
For file:// URIs to images, if there is a URI-escaped space (or perhaps other charactter, I haven't checked), it will cause issues finding and loading the image/file (at least on Windows 11). I suspect this is due to this function:
https://github.com/emilk/egui/blob/68b74530b7848cef6bff4efc5fc9906bfbd1e8ca/crates/egui_extras/src/loaders/file_loader.rs#L32
which does not handle file:// URIs as actual URIs with escaping, and instead just strips the prefix.
Here's the log message with a file path, showing a %20 representing a space in my username.
[desktop\src\view\search\col_format.rs:22:35] uri.as_str() = "file:///C:/Users/alfri/AppData/Local/Venus%20Xeon-Blonde/Oshibana/cache/symbology-cache/U.svg"
Screenshots
With initial code:
ui.image(uri.as_str());
With workaround:
match uri.to_file_path() {
Ok(path) => {
let reformatted = if cfg!(windows) {
format!("file:///{}", path.display())
} else {
format!("file://{}", path.display())
};
ui.image(reformatted);
},
Err(_) => {
ui.image(uri.as_str());
},
};
Desktop (please complete the following information):
- OS: Windows 11
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 73
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from emilk/egui
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Slider helper. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100