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:
|
fn convert_uri_to_path(s: &str) -> Result<PathBuf, egui::load::LoadError> { |
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:
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):
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:egui/crates/egui_extras/src/loaders/file_loader.rs
Line 32 in 68b7453
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
%20representing a space in my username.Screenshots
With initial code:
With workaround:
Desktop (please complete the following information):