taildrop: Allow category Z unicode characters (#10750)

This will expand the unicode character categories that we allow for valid filenames to go from "L, M, N, P, S, and the ASCII space character" to "L, M, N, P, S, Zs"

Fixes #10105

Signed-off-by: Rhea Ghosh <rhea@tailscale.com>
This commit is contained in:
Rhea Ghosh
2024-01-05 12:53:24 -06:00
committed by GitHub
parent d3574a350f
commit dbe70962b1
2 changed files with 2 additions and 1 deletions

View File

@@ -169,7 +169,7 @@ func validFilenameRune(r rune) bool {
// sent.
return false
}
return unicode.IsPrint(r)
return unicode.IsGraphic(r)
}
func isPartialOrDeleted(s string) bool {

View File

@@ -55,6 +55,7 @@ func TestNextFilename(t *testing.T) {
{"my song.mp3", "my song (1).mp3", "my song (2).mp3"},
{"archive.7z", "archive (1).7z", "archive (2).7z"},
{"foo/bar/fizz", "foo/bar/fizz (1)", "foo/bar/fizz (2)"},
{"新完全マスター N2 文法.pdf", "新完全マスター N2 文法 (1).pdf", "新完全マスター N2 文法 (2).pdf"},
}
for _, tt := range tests {