fix: backend url normalization
Docker Build & Publish / build (push) Failing after 3m9s
Docker Build & Publish / push (push) Has been skipped
Docker Build & Publish / Prune old image versions (push) Has been skipped

This commit is contained in:
2026-06-10 13:49:38 +03:00
parent 55aa8933af
commit 2ad3b128d6
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -29,8 +29,13 @@ const ACTIVE_KEY = 'mcma:activeInstance';
const LEGACY_URL_KEY = 'mcma_api_base_url';
const LEGACY_AUTH_KEY = 'mcma_auth';
// The UI always talks to the `/api/v1` contract, so users only enter the
// origin (and optional reverse-proxy prefix). We append the contract path
// here, the single choke point for both the base URL and the instance id, so
// `domain.com`, `domain.com/`, and `domain.com/api/v1` all converge.
function normalizeUrl(url: string): string {
return url.trim().replace(/\/+$/, '');
const trimmed = url.trim().replace(/\/+$/, '');
return /\/api\/v1$/.test(trimmed) ? trimmed : `${trimmed}/api/v1`;
}
/** Stable, readable id from a base URL — also serves as the storage namespace. */