From 4c4435bc198ad6361be2a580c3b9bff626d31be4 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 14 Jul 2023 09:58:14 -0400 Subject: [PATCH] fix: serve absolute urls (#3265) --- server/src/immich/api-v1/asset/asset.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/immich/api-v1/asset/asset.service.ts b/server/src/immich/api-v1/asset/asset.service.ts index 1aeac5ac0d..795a7148a1 100644 --- a/server/src/immich/api-v1/asset/asset.service.ts +++ b/server/src/immich/api-v1/asset/asset.service.ts @@ -591,9 +591,11 @@ export class AssetService { private async sendFile(res: Res, filepath: string): Promise { await fs.access(filepath, constants.R_OK); + const options = path.isAbsolute(filepath) ? {} : { root: process.cwd() }; + res.set('Cache-Control', 'private, max-age=86400, no-transform'); res.header('Content-Type', mimeTypes.lookup(filepath)); - res.sendFile(filepath, { root: process.cwd() }, (error: Error) => { + res.sendFile(filepath, options, (error: Error) => { if (!error) { return; }