feat: optionally generate thumbnails for invalid images (#11126)

This commit is contained in:
Saschl
2024-07-18 18:07:22 +02:00
committed by GitHub
parent c77702279c
commit d37e8ede3b
7 changed files with 57 additions and 13 deletions

View File

@@ -45,7 +45,8 @@ export class MediaRepository implements IMediaRepository {
}
async generateThumbnail(input: string | Buffer, output: string, options: ThumbnailOptions): Promise<void> {
const pipeline = sharp(input, { failOn: 'error', limitInputPixels: false })
// some invalid images can still be processed by sharp, but we want to fail on them by default to avoid crashes
const pipeline = sharp(input, { failOn: options.processInvalidImages ? 'none' : 'error', limitInputPixels: false })
.pipelineColorspace(options.colorspace === Colorspace.SRGB ? 'srgb' : 'rgb16')
.rotate();