Fix download file extensions when Immich serves WebP previews
With maxDownloadQuality=preview and Immich generating WebP previews, the zip entries and per-asset downloads were named .jpg while carrying WebP bytes. Previews, converted fullsize images and transcodes follow the server's image settings, so derive the extension from the upstream content-type for every non-/original endpoint, via a shared servedMimeFrom() in gallery/sizing.ts.
This commit is contained in:
@@ -53,10 +53,9 @@ function withMimeExtension (filename: string, mime: string | undefined): string
|
||||
/**
|
||||
* Generate a filename for the downloaded asset based on the configuration option chosen.
|
||||
*
|
||||
* The extension reflects what bytes the user will receive, not what the
|
||||
* original was - when Immich downgrades an image-original to preview (see
|
||||
* resolveImageEndpoint), the served bytes are JPEG even if the original is
|
||||
* HEIC/DNG/RAW, and the filename must match the bytes.
|
||||
* The extension reflects the served bytes, not the original: converted
|
||||
* bytes follow Immich's image settings, so pass the upstream content-type
|
||||
* as `servedMimeOverride`.
|
||||
*
|
||||
* @param asset
|
||||
* @param [servedSize] - what size Immich will actually serve. Defaults to
|
||||
|
||||
Reference in New Issue
Block a user