Make media upload file extension validation case insensitive. Closes #1256.

This commit is contained in:
Kailash Nadh 2023-03-25 11:46:05 +05:30
parent bf72154727
commit 5aedc3a4f6

View file

@ -6,6 +6,7 @@ import (
"net/http"
"path/filepath"
"strconv"
"strings"
"github.com/disintegration/imaging"
"github.com/knadh/listmonk/models"
@ -39,7 +40,7 @@ func handleUploadMedia(c echo.Context) error {
}
// Validate file extension.
ext := filepath.Ext(file.Filename)
ext := strings.ToLower(filepath.Ext(file.Filename))
if ok := inArray(ext, validExts); !ok {
return echo.NewHTTPError(http.StatusBadRequest,
app.i18n.Ts("media.unsupportedFileType", "type", ext))