cap the file name before normalization

This commit is contained in:
Gani Georgiev
2025-12-19 16:58:08 +02:00
parent c2d6530065
commit d08da7594a
2 changed files with 10 additions and 2 deletions

View File

@@ -193,6 +193,13 @@ var extInvalidCharsRegex = regexp.MustCompile(`[^\w\.\*\-\+\=\#]+`)
const randomAlphabet = "abcdefghijklmnopqrstuvwxyz0123456789"
func normalizeName(fr FileReader, name string) string {
// cut the name even if it is not multibyte safe to avoid operating on too large strings
// ---
originalLength := len(name)
if originalLength > 300 {
name = name[originalLength-300:]
}
// extension
// ---
originalExt := extractExtension(name)