diff --git a/package.json b/package.json index b208949..ff3e04a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hubs-backup-tool", "productName": "Hubs Backup Tool", - "version": "1.0.5", + "version": "1.0.6", "description": "Tool for backing up your assets from a Hubs instance", "main": ".webpack/main", "scripts": { diff --git a/src/api/reticulum-api.ts b/src/api/reticulum-api.ts index 2c6f669..89bb5f3 100644 --- a/src/api/reticulum-api.ts +++ b/src/api/reticulum-api.ts @@ -144,6 +144,10 @@ interface MediaWithCursorT { probe?: boolean; } +function sanitizedURL(url: string) { + return url.replace(/([^:]\/)\/+/g, "$1"); +} + export class ReticulumApi { options: ReticulumApiOptions; @@ -152,15 +156,17 @@ export class ReticulumApi { } getUrl(path: string): string { - return `https://${this.options.host}${ + const url = `https://${this.options.host}${ this.options.port ? ":" + this.options.port : "" }/api/v1/${path}`; + return sanitizedURL(url); } getRoomObjectsUrl(hubId: string) { - return `https://${this.options.host}${ + const url = `https://${this.options.host}${ this.options.port ? ":" + this.options.port : "" }/${hubId}/objects.gltf`; + return sanitizedURL(url); } api(path: string, method = "GET", payload?: JSON): Promise {