mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
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.
This commit is contained in:
@@ -83,11 +83,27 @@ export default function MobileUploadModal({
|
||||
const timerIntervalRef = useRef<number | null>(null);
|
||||
const processedFiles = useRef<Set<string>>(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(
|
||||
|
||||
Reference in New Issue
Block a user