From b3b46f89b2e3f7137877537a48c30811c92d47e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 12 Sep 2022 12:40:06 +0200 Subject: [PATCH] Fix T100757: error stating OpenEXR format is unknown format Fix T100757 by reducing the log level to "info" when Blender writes output to a file format the Worker cannot handle. Such cases are expected, and now no longer result in an error message. --- internal/worker/output_uploader.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/worker/output_uploader.go b/internal/worker/output_uploader.go index 14298dac..7ae37e3c 100644 --- a/internal/worker/output_uploader.go +++ b/internal/worker/output_uploader.go @@ -5,6 +5,7 @@ package worker import ( "bytes" "context" + "errors" "image" "image/jpeg" _ "image/png" @@ -140,7 +141,15 @@ func loadAsJPEG(imagePath string) []byte { // Try to decode the file as image. img, fileType, err := image.Decode(file) - if err != nil { + switch { + case errors.Is(err, image.ErrFormat): + // Blender writing formats not supported by this Go code will happen, for + // example EXR files. This is fine, and shouldn't even trigger a warning. + logger.Info().Msg("output uploader: file a format I cannot decode, ignoring it") + return nil + case err != nil: + // Any other error than the above is more serious, though, because that + // could mean file corruption. logger.Error().Err(err).Msg("output uploader: cannot decode image file") return nil }