We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40a39bd commit 8c1d04fCopy full SHA for 8c1d04f
src/controller/index.ts
@@ -97,9 +97,17 @@ export class ScramjetController {
97
}
98
99
encodeUrl(url: string | URL): string {
100
- if (url instanceof URL) url = url.toString();
+ if (typeof url === "string") url = new URL(url);
101
+
102
+ if (url.protocol != "http:" && url.protocol != "https:") {
103
+ return url.href;
104
+ }
105
106
+ const encodedHash = codecEncode(url.hash.slice(1));
107
+ const realHash = encodedHash ? "#" + encodedHash : "";
108
+ url.hash = "";
109
- return config.prefix + codecEncode(url);
110
+ return config.prefix + codecEncode(url.href) + realHash;
111
112
113
decodeUrl(url: string | URL) {
0 commit comments