mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 10:42:05 +03:00
Decode URL pathname for opened file (#11118)
- Attempt to fix an issue where a project opened by double clicking does not URL decode the path to be opened. - Unable to properly test as I don't normally use Windows (file associations do not work on Linux as we use an AppImage for that platform.) # Important Notes None
This commit is contained in:
parent
38685dafa9
commit
9126ab23e4
@ -106,10 +106,12 @@ function fileURLToPath(url: string): string | null {
|
|||||||
if (URL.canParse(url)) {
|
if (URL.canParse(url)) {
|
||||||
const parsed = new URL(url)
|
const parsed = new URL(url)
|
||||||
if (parsed.protocol === 'file:') {
|
if (parsed.protocol === 'file:') {
|
||||||
return detect.platform() === detect.Platform.windows ?
|
return decodeURIComponent(
|
||||||
|
detect.platform() === detect.Platform.windows ?
|
||||||
// On Windows, we must remove leading `/` from URL.
|
// On Windows, we must remove leading `/` from URL.
|
||||||
parsed.pathname.slice(1)
|
parsed.pathname.slice(1)
|
||||||
: parsed.pathname
|
: parsed.pathname,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user