mirror of https://github.com/yt-dlp/yt-dlp.git
[utils] `sanitize_path`: Fix when path is empty string
This commit is contained in:
parent
d46a3e7a12
commit
4abea8ca0a
|
@ -2237,7 +2237,7 @@ class YoutubeDL(object):
|
||||||
matches = LazyList(_check_formats(matches[::-1 if format_reverse else 1]))
|
matches = LazyList(_check_formats(matches[::-1 if format_reverse else 1]))
|
||||||
try:
|
try:
|
||||||
yield matches[format_idx - 1]
|
yield matches[format_idx - 1]
|
||||||
except IndexError:
|
except LazyList.IndexError:
|
||||||
return
|
return
|
||||||
|
|
||||||
filters = [self._build_format_filter(f) for f in selector.filters]
|
filters = [self._build_format_filter(f) for f in selector.filters]
|
||||||
|
|
|
@ -778,7 +778,7 @@ def sanitize_path(s, force=False):
|
||||||
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)
|
||||||
elif force and s[0] == os.path.sep:
|
elif force and s and s[0] == os.path.sep:
|
||||||
sanitized_path.insert(0, os.path.sep)
|
sanitized_path.insert(0, os.path.sep)
|
||||||
return os.path.join(*sanitized_path)
|
return os.path.join(*sanitized_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue