From acfdcdbc63ead3328ee98497d0179da10b089f99 Mon Sep 17 00:00:00 2001 From: jeppevinkel Date: Wed, 10 Jul 2024 01:22:12 +0200 Subject: [PATCH] Fix referral url when subdomain contains `account` This fix should work to grab the base url more consistently when the sub domain includes `account` in the name. --- ts/user.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ts/user.ts b/ts/user.ts index de13f63..d100031 100644 --- a/ts/user.ts +++ b/ts/user.ts @@ -267,9 +267,8 @@ class ReferralCard { set code(c: string) { this._code = c; let url = window.location.href; - for (let split of ["#", "?", "account", "my"]) { - url = url.split(split)[0]; - } + let pathArray = url.split('/'); + url = `${pathArray[0]}//${pathArray[2]}/`; if (url.slice(-1) != "/") { url += "/"; } url = url + "invite/" + this._code; this._url = url;