From d997a1da984e49e06205058c821950e3763a325c Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 19 Sep 2026 02:35:59 +0200 Subject: [PATCH] fix: pass through to next thumbnail generator on decoder failure (#13) vips/ffmpeg/libreoffice returning a non-zero exit used to abort the whole thumbnail pipeline, so files like psd or html never reached a generator that could handle them. Wrap invoke errors in ErrPassThrough so later generators get a chance. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- pkg/thumb/ffmpeg.go | 2 +- pkg/thumb/libreoffice.go | 2 +- pkg/thumb/vips.go | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/thumb/ffmpeg.go b/pkg/thumb/ffmpeg.go index e0742509..0112b8e6 100644 --- a/pkg/thumb/ffmpeg.go +++ b/pkg/thumb/ffmpeg.go @@ -94,7 +94,7 @@ func (f *FfmpegGenerator) Generate(ctx context.Context, es entitysource.EntitySo if err := cmd.Run(); err != nil { f.l.Warning("Failed to invoke ffmpeg: %s", stdErr.String()) - return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke ffmpeg: %w, raw output: %s", err, stdErr.String()) + return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke ffmpeg: %w, raw output: %s: %w", err, stdErr.String(), ErrPassThrough) } return &Result{Path: tempOutputPath}, nil diff --git a/pkg/thumb/libreoffice.go b/pkg/thumb/libreoffice.go index 89fbdef4..42d6abd7 100644 --- a/pkg/thumb/libreoffice.go +++ b/pkg/thumb/libreoffice.go @@ -79,7 +79,7 @@ func (l *LibreOfficeGenerator) Generate(ctx context.Context, es entitysource.Ent if err := cmd.Run(); err != nil { l.l.Warning("Failed to invoke LibreOffice: %s", stdErr.String()) - return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke LibreOffice: %w, raw output: %s", err, stdErr.String()) + return &Result{Path: tempOutputPath}, fmt.Errorf("failed to invoke LibreOffice: %w, raw output: %s: %w", err, stdErr.String(), ErrPassThrough) } return &Result{ diff --git a/pkg/thumb/vips.go b/pkg/thumb/vips.go index bd344fd2..99dadca5 100644 --- a/pkg/thumb/vips.go +++ b/pkg/thumb/vips.go @@ -105,7 +105,10 @@ func (v *VipsGenerator) Generate(ctx context.Context, es entitysource.EntitySour if err := cmd.Run(); err != nil { v.l.Warning("Failed to invoke vips: %s", vipsErr.String()) - return &Result{Path: tempPath}, fmt.Errorf("failed to invoke vips: %w, raw output: %s", err, vipsErr.String()) + // A non-zero exit usually means vips cannot decode the format (e.g. + // psd, html). Pass through so later generators can try instead of + // failing the whole pipeline. + return &Result{Path: tempPath}, fmt.Errorf("failed to invoke vips: %w, raw output: %s: %w", err, vipsErr.String(), ErrPassThrough) } return &Result{Path: tempPath}, nil