From 36c68fb69ed606cd830def73ed3a397ba52fd8b5 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+frooodle@users.noreply.github.com> Date: Wed, 10 Jun 2026 17:21:42 +0100 Subject: [PATCH] fix: doubled base path in mobile-scanner QR URL A configured frontendUrl/server_url already includes the subpath (e.g. /bpp), but the code also applied withBasePath, producing /bpp/bpp/... Append the route directly to a configured URL; reserve withBasePath for the bare-origin fallback. Matches the ShareFileModal convention. --- .../components/shared/MobileUploadModal.tsx | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/frontend/editor/src/core/components/shared/MobileUploadModal.tsx b/frontend/editor/src/core/components/shared/MobileUploadModal.tsx index 0232ef93f..c76d4ce52 100644 --- a/frontend/editor/src/core/components/shared/MobileUploadModal.tsx +++ b/frontend/editor/src/core/components/shared/MobileUploadModal.tsx @@ -83,11 +83,27 @@ export default function MobileUploadModal({ const timerIntervalRef = useRef(null); const processedFiles = useRef>(new Set()); - // Use configured frontendUrl if set, otherwise use current origin - // Combine with base path and mobile-scanner route - const baseUrl = localStorage.getItem("server_url") || ""; - const frontendUrl = baseUrl || config?.frontendUrl || window.location.origin; - const mobileUrl = `${frontendUrl}${withBasePath("/mobile-scanner")}?session=${sessionId}`; + // A configured server_url/frontendUrl already includes any subpath, so append + // the route directly; only the bare-origin fallback needs withBasePath. + const configuredUrl = ( + localStorage.getItem("server_url") || + config?.frontendUrl || + "" + ).trim(); + let mobileBase = ""; + if (configuredUrl) { + try { + const parsed = new URL(configuredUrl); + if (parsed.protocol === "http:" || parsed.protocol === "https:") { + mobileBase = configuredUrl.replace(/\/$/, ""); + } + } catch { + // invalid configured URL — fall back to origin + } + } + const mobileUrl = mobileBase + ? `${mobileBase}/mobile-scanner?session=${sessionId}` + : `${window.location.origin}${withBasePath("/mobile-scanner")}?session=${sessionId}`; // Create session on backend const createSession = useCallback(