]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[utils:sanitize_path] Disallow trailing whitespace in path segment (Closes #7332)
authorSergey M․ <dstftw@gmail.com>
Sun, 1 Nov 2015 22:26:20 +0000 (04:26 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 1 Nov 2015 22:26:20 +0000 (04:26 +0600)
youtube_dl/utils.py

index efd5f4ae111448ca9933136b151ca1bf6a0505a8..7b3f79141fff9abb12b7ac2a532592d790a8171c 100644 (file)
@@ -366,7 +366,7 @@ def sanitize_path(s):
     if drive_or_unc:
         norm_path.pop(0)
     sanitized_path = [
-        path_part if path_part in ['.', '..'] else re.sub('(?:[/<>:"\\|\\\\?\\*]|\.$)', '#', path_part)
+        path_part if path_part in ['.', '..'] else re.sub('(?:[/<>:"\\|\\\\?\\*]|[\s.]$)', '#', path_part)
         for path_part in norm_path]
     if drive_or_unc:
         sanitized_path.insert(0, drive_or_unc + os.path.sep)