Tidy up WebP download filename fix #297

This commit is contained in:
Alan Grainger
2026-10-05 09:12:10 +13:00
parent 2a99258278
commit 0ae17abdc0
8 changed files with 33 additions and 38 deletions
+5 -1
View File
@@ -56,11 +56,15 @@ describe('getFilename servedMime override (playback-fallback downloads)', () =>
})
})
describe('getFilename converted-byte previews (e.g. WebP preview generation)', () => {
describe('getFilename WebP previews', () => {
it('swaps the extension to match the served preview bytes', () => {
expect(getFilename(imageAsset('holiday.heic'), ImageSize.preview, 'image/webp')).toBe('holiday.webp')
})
it('matches the served MIME type case-insensitively', () => {
expect(getFilename(imageAsset('holiday.heic'), ImageSize.preview, 'image/WebP')).toBe('holiday.webp')
})
it('keeps a JPEG extension when the preview is JPEG', () => {
expect(getFilename(imageAsset('holiday.heic'), ImageSize.preview, 'image/jpeg')).toBe('holiday.jpg')
})