mirror of
https://github.com/knadh/listmonk.git
synced 2025-10-02 19:35:28 +08:00
Remove ASCII-only restriction on media filenames. Closes #2277.
This commit is contained in:
parent
0be7a79dac
commit
5f1b676401
2 changed files with 0 additions and 14 deletions
|
@ -48,10 +48,6 @@ func handleUploadMedia(c echo.Context) error {
|
|||
ext = strings.TrimPrefix(strings.ToLower(filepath.Ext(file.Filename)), ".")
|
||||
contentType = file.Header.Get("Content-Type")
|
||||
)
|
||||
if !isASCII(file.Filename) {
|
||||
return echo.NewHTTPError(http.StatusUnprocessableEntity,
|
||||
app.i18n.Ts("media.invalidFileName", "name", file.Filename))
|
||||
}
|
||||
|
||||
// Validate file extension.
|
||||
if !inArray("*", app.constants.MediaUpload.Extensions) {
|
||||
|
|
10
cmd/utils.go
10
cmd/utils.go
|
@ -8,7 +8,6 @@ import (
|
|||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
|
@ -124,12 +123,3 @@ func titleCase(input string) string {
|
|||
|
||||
return strings.Join(parts, " ")
|
||||
}
|
||||
|
||||
func isASCII(s string) bool {
|
||||
for _, c := range s {
|
||||
if c > unicode.MaxASCII {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue