aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/downloader')
-rw-r--r--yt_dlp/downloader/common.py6
-rw-r--r--yt_dlp/downloader/http.py3
2 files changed, 7 insertions, 2 deletions
diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py
index afd2f2e38..cbfea7a65 100644
--- a/yt_dlp/downloader/common.py
+++ b/yt_dlp/downloader/common.py
@@ -11,6 +11,7 @@ from ..utils import (
encodeFilename,
error_to_compat_str,
format_bytes,
+ LockingUnsupportedError,
sanitize_open,
shell_quote,
timeconvert,
@@ -234,7 +235,10 @@ class FileDownloader(object):
@wrap_file_access('open', fatal=True)
def sanitize_open(self, filename, open_mode):
- return sanitize_open(filename, open_mode)
+ f, filename = sanitize_open(filename, open_mode)
+ if not getattr(f, 'locked', None):
+ self.write_debug(f'{LockingUnsupportedError.msg}. Proceeding without locking', only_once=True)
+ return f, filename
@wrap_file_access('remove')
def try_remove(self, filename):
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py
index 591a9b08d..a232168fa 100644
--- a/yt_dlp/downloader/http.py
+++ b/yt_dlp/downloader/http.py
@@ -145,7 +145,8 @@ class HttpFD(FileDownloader):
or content_len < range_end)
if accept_content_len:
ctx.content_len = content_len
- ctx.data_len = min(content_len, req_end or content_len) - (req_start or 0)
+ if content_len or req_end:
+ ctx.data_len = min(content_len or req_end, req_end or content_len) - (req_start or 0)
return
# Content-Range is either not present or invalid. Assuming remote webserver is
# trying to send the whole file, resume is not possible, so wiping the local file