[utils] Make restricted filenames ignore characters in Unicode categories Mark, Other
authordirkf <fieldhouse@gmx.net>
Tue, 28 Nov 2023 17:26:37 +0000 (17:26 +0000)
committerdirkf <fieldhouse@gmx.net>
Wed, 29 Nov 2023 22:08:01 +0000 (22:08 +0000)
Resolves #32629

youtube_dl/utils.py

index 443d2609c96a6dcca7711e408bb83b7cfe05a972..61b94d84c44e54488bde08f30f53e6bf51be5b14 100644 (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