This commit is contained in:
legop3
2025-11-18 16:56:55 -05:00
parent 080c9c8fce
commit d812a1fc6c
3 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -14,14 +14,14 @@ function buildWhepUrl(roverId) {
if (!base) {
return '';
}
let origin;
let prefix = base;
try {
const parsed = new URL(base);
origin = parsed.origin;
prefix = `${parsed.origin}${parsed.pathname}`;
} catch (err) {
origin = base.replace(/\/.*$/, '');
// leave prefix as-is when URL parsing fails; fall back to string cleanup below
}
const cleanBase = origin.replace(/\/$/, '');
const cleanBase = prefix.replace(/\/+$/, '');
const encodedId = encodeURIComponent(roverId);
return `${cleanBase}/${encodedId}/whep`;
}