mirror of
https://github.com/immich-app/immich.git
synced 2025-01-06 03:46:47 +01:00
fix: serve absolute urls (#3265)
This commit is contained in:
parent
f952bc0b64
commit
4c4435bc19
1 changed files with 3 additions and 1 deletions
|
@ -591,9 +591,11 @@ export class AssetService {
|
||||||
|
|
||||||
private async sendFile(res: Res, filepath: string): Promise<void> {
|
private async sendFile(res: Res, filepath: string): Promise<void> {
|
||||||
await fs.access(filepath, constants.R_OK);
|
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.set('Cache-Control', 'private, max-age=86400, no-transform');
|
||||||
res.header('Content-Type', mimeTypes.lookup(filepath));
|
res.header('Content-Type', mimeTypes.lookup(filepath));
|
||||||
res.sendFile(filepath, { root: process.cwd() }, (error: Error) => {
|
res.sendFile(filepath, options, (error: Error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue