diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 1edf3ff47..67201eb5f 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -26,6 +26,7 @@ After processing, the content will be moved to the main changelog and this file - Fix window menu crash on Wayland caused by appmenu-gtk-module accessing unrealized window (#4769) by @leaanthony - Fix GTK application crash when app name contains invalid characters (spaces, parentheses, etc.) by @leaanthony - Fix "not enough memory" error when initializing drag and drop on Windows (#4701) by @overlordtm +- Fix file explorer opening wrong directory on Linux due to incorrect URI escaping (#4397) by @leaanthony - Fix AppImage build failure on modern Linux distributions (Arch, Fedora 39+, Ubuntu 24.04+) by auto-detecting `.relr.dyn` ELF sections and disabling stripping (#4642) by @leaanthony diff --git a/v3/internal/fileexplorer/fileexplorer_linux.go b/v3/internal/fileexplorer/fileexplorer_linux.go index f78b07ef7..cd0201dfc 100644 --- a/v3/internal/fileexplorer/fileexplorer_linux.go +++ b/v3/internal/fileexplorer/fileexplorer_linux.go @@ -86,7 +86,14 @@ func pathToURI(path string) string { if err != nil { return path } - return "file://" + url.PathEscape(absPath) + // Use url.URL to properly construct file URIs. + // url.PathEscape incorrectly escapes forward slashes (/ -> %2F), + // which breaks file manager path parsing. + u := &url.URL{ + Scheme: "file", + Path: absPath, + } + return u.String() } func findDesktopFile(xdgFileName string) (string, error) {