fix(img):Prevent thumbnail generation for large images

This commit is contained in:
jagadam97 2025-10-27 04:44:31 +05:30 committed by Henrique Dias
parent c18afcddc4
commit d00b3ea8f8
2 changed files with 19 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import (
"strings"
libErrors "github.com/filebrowser/filebrowser/v2/errors"
imgErrors "github.com/filebrowser/filebrowser/v2/img"
)
func renderJSON(w http.ResponseWriter, _ *http.Request, data interface{}) (int, error) {
@ -42,6 +43,8 @@ func errToStatus(err error) int {
return http.StatusBadRequest
case errors.Is(err, libErrors.ErrRootUserDeletion):
return http.StatusForbidden
case errors.Is(err, imgErrors.ErrImageTooLarge):
return http.StatusRequestEntityTooLarge
default:
return http.StatusInternalServerError
}