From b1e4c830b2a310b7bc2284d9b14099e7f65b494b Mon Sep 17 00:00:00 2001 From: jubnl Date: Sat, 15 Aug 2026 23:05:44 +0200 Subject: [PATCH] fix(immich): strip leading / in immich url (#1948) --- server/src/nest/memories/immich.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/nest/memories/immich.service.ts b/server/src/nest/memories/immich.service.ts index 511d29546..c52f71449 100644 --- a/server/src/nest/memories/immich.service.ts +++ b/server/src/nest/memories/immich.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import type { Response } from 'express'; -import path from 'path'; import { maybe_encrypt_api_key, decrypt_api_key } from '../common/crypto/apiKeyCrypto'; import { checkSsrf, safeFetch } from '../../utils/ssrfGuard'; import { AuditService } from '../audit/audit.service'; @@ -79,6 +78,9 @@ export class ImmichService { clientIp: string | null ): Promise<{ success: boolean; warning?: string; error?: string }> { if (immichUrl) { + if (immichUrl.endsWith('/')) { + immichUrl = immichUrl.slice(0, -1); + } const ssrf = await checkSsrf(immichUrl.trim()); if (!ssrf.allowed) { return { success: false, error: `Invalid Immich URL: ${ssrf.error}` }; @@ -116,6 +118,9 @@ export class ImmichService { immichUrl: string, immichApiKey: string ): Promise<{ connected: boolean; error?: string; user?: { name?: string; email?: string }; canonicalUrl?: string }> { + if (immichUrl.endsWith('/')) { + immichUrl = immichUrl.slice(0, -1); + } const ssrf = await checkSsrf(immichUrl); if (!ssrf.allowed) return { connected: false, error: ssrf.error ?? 'Invalid Immich URL' }; try {