summaryrefslogtreecommitdiff
path: root/std/path/posix.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-08-21 14:37:06 +0100
committerGitHub <noreply@github.com>2020-08-21 15:37:06 +0200
commitcf603be24cdc92b6758c602c005f37f4d5f6c5b6 (patch)
tree4e0d0212a44ad8af3a777cebf65bf266e5c06523 /std/path/posix.ts
parentfd83df7cdb983030ba111a1e19ad6c9ef5eb6128 (diff)
fix: Allow isolated "%"s when parsing file URLs (#7108)
Diffstat (limited to 'std/path/posix.ts')
-rw-r--r--std/path/posix.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/std/path/posix.ts b/std/path/posix.ts
index afbc9303f..33b94a916 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -436,5 +436,7 @@ export function fromFileUrl(url: string | URL): string {
if (url.protocol != "file:") {
throw new TypeError("Must be a file URL.");
}
- return decodeURIComponent(url.pathname);
+ return decodeURIComponent(
+ url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"),
+ );
}