mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-01-23 02:35:10 +00:00
fix(img):Prevent thumbnail generation for large images
This commit is contained in:
parent
c18afcddc4
commit
d00b3ea8f8
2 changed files with 19 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue