From 82be015fc53cd254956dbfe32e0cdc8a906b1166 Mon Sep 17 00:00:00 2001 From: Alban Bruder Date: Tue, 12 Apr 2022 12:28:36 -0400 Subject: [PATCH] Compute instance in back getMapDetails --- back/src/Model/GameRoom.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index 5b1e13bf..ae907114 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -562,13 +562,14 @@ export class GameRoom { if (!ADMIN_API_URL) { const roomUrlObj = new URL(roomUrl); - const match = /\/_\/[^/]+\/(.+)/.exec(roomUrlObj.pathname); + const match = /\/_\/([^/]+)\/(.+)/.exec(roomUrlObj.pathname); if (!match) { console.error("Unexpected room URL", roomUrl); throw new Error('Unexpected room URL "' + roomUrl + '"'); } - const mapUrl = roomUrlObj.protocol + "//" + match[1]; + const instance = match[1]; + const mapUrl = roomUrlObj.protocol + "//" + match[2]; return { mapUrl, @@ -578,6 +579,7 @@ export class GameRoom { roomSlug: null, contactPage: null, group: null, + instance }; }