From c4218ac3f1146daac20308439cdc374e3561101a Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 25 Feb 2021 00:02:44 +0530 Subject: [PATCH] Fix `--windows-filenames` removing `/` from UNIX paths :ci skip all --- youtube_dlc/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/youtube_dlc/utils.py b/youtube_dlc/utils.py index c696373e2..b33a40fa6 100644 --- a/youtube_dlc/utils.py +++ b/youtube_dlc/utils.py @@ -2128,6 +2128,7 @@ def sanitize_filename(s, restricted=False, is_id=False): def sanitize_path(s, force=False): """Sanitizes and normalizes path on Windows""" if sys.platform == 'win32': + force = False drive_or_unc, _ = os.path.splitdrive(s) if sys.version_info < (2, 7) and not drive_or_unc: drive_or_unc, _ = os.path.splitunc(s) @@ -2144,6 +2145,8 @@ def sanitize_path(s, force=False): for path_part in norm_path] if drive_or_unc: sanitized_path.insert(0, drive_or_unc + os.path.sep) + elif force and s[0] == os.path.sep: + sanitized_path.insert(0, os.path.sep) return os.path.join(*sanitized_path)