[utils] Make restricted filenames ignore characters in Unicode categories Mark, Other

Resolves #32629
This commit is contained in:
dirkf 2023-11-28 17:26:37 +00:00 committed by GitHub Actions
parent ebfac5f6a1
commit 34bec329e7

View File

@ -2121,7 +2121,8 @@ def sanitize_filename(s, restricted=False, is_id=False):
if restricted and (char in '!&\'()[]{}$;`^,#' or char.isspace()):
return '_'
if restricted and ord(char) > 127:
return '_'
return '' if unicodedata.category(char)[0] in 'CM' else '_'
return char
# Replace look-alike Unicode glyphs