feat(server): specify names for thumbnail files (#14425)

This commit is contained in:
Eli Gao 2024-12-02 03:21:08 +08:00 committed by GitHub
parent 56d2309122
commit 4eb7758f56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View file

@ -24,6 +24,7 @@ export class ImmichFileResponse {
public readonly path!: string;
public readonly contentType!: string;
public readonly cacheControl!: CacheControl;
public readonly fileName?: string;
constructor(response: ImmichFileResponse) {
Object.assign(this, response);
@ -56,6 +57,9 @@ export const sendFile = async (
}
res.header('Content-Type', file.contentType);
if (file.fileName) {
res.header('Content-Disposition', `inline; filename="${file.fileName}"`);
}
const options: SendFileOptions = { dotfiles: 'allow' };
if (!isAbsolute(file.path)) {