fix: images proxy handler now handle all image types

This commit is contained in:
rramiachraf 2024-05-30 18:40:19 +01:00
parent 8241deac12
commit 0381b6e4ae

View File

@ -14,11 +14,14 @@ import (
)
func isValidExt(ext string) bool {
valid := []string{"jpg", "jpeg", "png", "gif"}
for _, c := range valid {
if strings.ToLower(ext) == c {
return true
extType := mime.TypeByExtension("." + strings.ToLower(ext))
isImage, _, found := strings.Cut(extType, "/")
if !found {
return false
}
if isImage == "image" {
return true
}
return false