Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

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

Kailash Nadh5aedc3a4f66d
diff --git a/cmd/media.go b/cmd/media.go
index 0a3cc746..13a03f83 100644
--- a/cmd/media.go
+++ b/cmd/media.go
@@ -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))