Skip to content

Commit 6662d68

Browse files
committed
Handle URL encoding properly.
1 parent 96c605b commit 6662d68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decompressFromBase64 } from "lz-string"
1+
import { decompressFromEncodedURIComponent } from "lz-string"
22

33
// Expected invocation is `node path/to/index.js $url`.
44
if (process.argv.length !== 3) {
@@ -8,7 +8,7 @@ if (process.argv.length !== 3) {
88
}
99

1010
const url = process.argv[2]
11-
const code = decompressFromBase64(new URL(url).hash.replace(/^#code\//, ""))
11+
const code = decompressFromEncodedURIComponent(new URL(url).hash.replace(/^#code\//, ""))
1212

1313
if (typeof code !== "string") {
1414
throw new Error(

0 commit comments

Comments
 (0)