release: v0.16.0
See CHANGELOG.md for the full v0.16.0 entry. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Ralf <rohlenbo79@gmail.com> Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
This commit is contained in:
25
lib/env.ts
25
lib/env.ts
@@ -25,13 +25,32 @@ export interface Env {
|
||||
SITE_URL?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip a trailing slash (or several) from a URL, after confirming it parses
|
||||
* at all. Deliberately not `/api`-aware, unlike install.ts's
|
||||
* normalizeApiBase(): this is the "base URL, no /api" shape getConfig()
|
||||
* expects (it appends /api itself unless the value already ends with one),
|
||||
* and it's what the install wizard's URL field pre-fills from — appending
|
||||
* /api here would mean re-opening the wizard shows a path nobody typed.
|
||||
*
|
||||
* Exported so lib/install.ts can apply the same normalisation to
|
||||
* content/install.json's apiUrl, which used to skip it entirely: a trailing
|
||||
* slash there produced IMMICH_API_URL//api and every request 404ed (#634).
|
||||
*/
|
||||
export function normalizeApiUrl(raw: string): string {
|
||||
try {
|
||||
return new URL(raw).toString().replace(/\/+$/, '');
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function parseEnv(): Env {
|
||||
const urlRaw = process.env.IMMICH_API_URL;
|
||||
let apiUrl = '';
|
||||
if (urlRaw) {
|
||||
try {
|
||||
apiUrl = new URL(urlRaw).toString().replace(/\/+$/, '');
|
||||
} catch {
|
||||
apiUrl = normalizeApiUrl(urlRaw);
|
||||
if (!apiUrl) {
|
||||
console.warn('⚠️ IMMICH_API_URL is invalid, falling back to empty string for setup.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user