Skip to content

Commit

Permalink
Fix --windows-filenames removing / from UNIX paths
Browse files Browse the repository at this point in the history
:ci skip all
  • Loading branch information
pukkandan committed Feb 24, 2021
1 parent a17417e commit c4218ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions youtube_dlc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,6 +2128,7 @@ def replace_insane(char):
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)
Expand All @@ -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)


Expand Down

0 comments on commit c4218ac

Please sign in to comment.