disallow some bad characters in foldPermissive

This commit is contained in:
Shivaram Lingamneni 2019-12-22 09:19:28 -05:00
parent 0df25e0e30
commit 2d4dbeba1c
2 changed files with 17 additions and 0 deletions

View file

@ -271,6 +271,11 @@ func IsPureASCII(str string) bool {
}
func foldPermissive(str string) (result string, err error) {
for _, r := range str {
if unicode.IsSpace(r) || r == 0 {
return "", errInvalidCharacter
}
}
// YOLO
str = norm.NFD.String(str)
str = cases.Fold().String(str)