fix: thumbnail content-type, animated GIF preservation, and janitor cleanup

- Add extension-based mimetype fallback in uploads route so thumbnail
  files serve correct Content-Type (image/webp) instead of falling back
  to application/octet-stream when DB lookup misses
- Skip animated images (metadata.pages > 1) during thumbnail generation
  to preserve GIF/WebP animations instead of flattening to static frame
- Remove redundant explicit thumbnail deletion in storageJanitor since
  deleteUploadFile() already auto-deletes the thumbnail variant
This commit is contained in:
Jannis Braun
2026-03-14 21:49:11 +01:00
parent 1750f12c85
commit ed4dcdcf69
3 changed files with 57 additions and 25 deletions
+5
View File
@@ -49,6 +49,11 @@ export async function generateThumbnail(
return null;
}
// Skip animated images — Sharp would flatten to a single static frame
if (metadata.pages && metadata.pages > 1) {
return null;
}
const originalFilename = path.basename(originalPath);
const thumbName = thumbFilename(originalFilename);
const thumbPath = path.join(uploadDir, thumbName);