0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[utils:sanitize_path] Disallow trailing whitespace in path segment (Closes #7332)

This commit is contained in:
Sergey M․ 2015-11-02 04:26:20 +06:00
parent ab6ca04802
commit c90d16cf36

View file

@ -366,7 +366,7 @@ def sanitize_path(s):
if drive_or_unc: if drive_or_unc:
norm_path.pop(0) norm_path.pop(0)
sanitized_path = [ 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] for path_part in norm_path]
if drive_or_unc: if drive_or_unc:
sanitized_path.insert(0, drive_or_unc + os.path.sep) sanitized_path.insert(0, drive_or_unc + os.path.sep)