diff --git a/server/src/utils/misc.test.ts b/server/src/utils/misc.test.ts index 34552a9f8..250c62630 100644 --- a/server/src/utils/misc.test.ts +++ b/server/src/utils/misc.test.ts @@ -15,6 +15,7 @@ t.test("#IsValidURL", (t) => { t.ok(IsValidURL("http://example.com/suburl")); t.ok(IsValidURL("http://example.com#href")); t.ok(IsValidURL("http://example.com?querystring")); + t.ok(IsValidURL("tachi-fdsaf7324hf://example.com?querystring")); t.notOk(IsValidURL("ftp://example.com")); diff --git a/server/src/utils/misc.ts b/server/src/utils/misc.ts index 7da7c47f3..fba16b958 100644 --- a/server/src/utils/misc.ts +++ b/server/src/utils/misc.ts @@ -127,7 +127,11 @@ export function IsValidURL(string: string) { try { const url = new URL(string); - return url.protocol === "http:" || url.protocol === "https:"; + return ( + url.protocol === "http:" || + url.protocol === "https:" || + /^tachi-[a-z0-9]+:$/u.exec(url.protocol) + ); } catch (_err) { return false; }