Fix image thumbnail generation (#2524)

* Better logging for thumbnail generation errors
* Reduce verbosity for thumbnail generation
* Provide stdin during thumbnail generation
This commit is contained in:
WithoutPants
2022-04-25 15:56:06 +10:00
committed by GitHub
parent 9e606feb76
commit 1b91937004
6 changed files with 25 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"errors"
"net/http"
"os/exec"
"strconv"
"github.com/go-chi/chi"
@@ -50,6 +51,11 @@ func (rs imageRoutes) Thumbnail(w http.ResponseWriter, r *http.Request) {
// don't log for unsupported image format
if !errors.Is(err, image.ErrNotSupportedForThumbnail) {
logger.Errorf("error generating thumbnail for image: %s", err.Error())
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
logger.Errorf("stderr: %s", string(exitErr.Stderr))
}
}
// backwards compatibility - fallback to original image instead