From dbe70962b1fe8c901c92fec805568af2193610d8 Mon Sep 17 00:00:00 2001 From: Rhea Ghosh Date: Fri, 5 Jan 2024 12:53:24 -0600 Subject: [PATCH] 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 --- taildrop/taildrop.go | 2 +- taildrop/taildrop_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/taildrop/taildrop.go b/taildrop/taildrop.go index 39ab5aff5..c9717c2d4 100644 --- a/taildrop/taildrop.go +++ b/taildrop/taildrop.go @@ -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 { diff --git a/taildrop/taildrop_test.go b/taildrop/taildrop_test.go index 967fc9b04..df4783c30 100644 --- a/taildrop/taildrop_test.go +++ b/taildrop/taildrop_test.go @@ -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 {