mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 09:13:15 +03:00
@@ -1,7 +1,7 @@
|
||||
import { HttpException, StreamableFile } from '@nestjs/common';
|
||||
import { NextFunction, Response } from 'express';
|
||||
import { access, constants } from 'node:fs/promises';
|
||||
import { basename, extname, isAbsolute } from 'node:path';
|
||||
import { basename, extname } from 'node:path';
|
||||
import { promisify } from 'node:util';
|
||||
import { CacheControl } from 'src/enum';
|
||||
import { LoggingRepository } from 'src/repositories/logging.repository';
|
||||
@@ -62,15 +62,9 @@ export const sendFile = async (
|
||||
res.header('Content-Disposition', `inline; filename*=UTF-8''${encodeURIComponent(file.fileName)}`);
|
||||
}
|
||||
|
||||
// configure options for serving
|
||||
const options: SendFileOptions = { dotfiles: 'allow' };
|
||||
if (!isAbsolute(file.path)) {
|
||||
options.root = process.cwd();
|
||||
}
|
||||
|
||||
await access(file.path, constants.R_OK);
|
||||
|
||||
return await _sendFile(file.path, options);
|
||||
return await _sendFile(file.path, { dotfiles: 'allow' });
|
||||
} catch (error: Error | any) {
|
||||
// ignore client-closed connection
|
||||
if (isConnectionAborted(error) || res.headersSent) {
|
||||
|
||||
Reference in New Issue
Block a user