Skip to content

Commit

Permalink
Make media upload file extension validation case insensitive. Closes k…
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Mar 25, 2023
1 parent bf72154 commit 5aedc3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"path/filepath"
"strconv"
"strings"

"github.com/disintegration/imaging"
"github.com/knadh/listmonk/models"
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 5aedc3a

Please sign in to comment.