commit: 427472351ce6b2fcf5bb35dde32bf9ee5beddd89
parent c6538ed323409707fc73e81fb7c93bc62ad11ac1
Author: dirkf <fieldhouse@gmx.net>
Date: Tue, 28 Nov 2023 17:26:37 +0000
[utils] Make restricted filenames ignore characters in Unicode categories Mark, Other
Resolves #32629
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
@@ -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