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 650554c commit c87c038Copy full SHA for c87c038
frontend/src/lib/utils.ts
@@ -23,13 +23,18 @@ export function debounce(func: Function, wait: number): EventListener {
23
export function tryAbsURL(url: string, base?: string): string {
24
if (!url) return url;
25
26
- let parsed = URL.parse(url, base);
27
- if (!parsed) {
+ try {
+ const parsed = new URL(url, base);
28
+ return parsed.href;
29
+ } catch {
30
if (url.startsWith('//')) {
- url = 'https:' + url;
31
32
+ const parsed = new URL('https:' + url, base);
33
34
35
+ return url;
36
+ }
37
}
- parsed = URL.parse(url, base);
38
39
-
- return parsed?.href || url;
40
0 commit comments