Skip to content

Commit b7d097e

Browse files
authored
Merge pull request #295 from ynput/bugfix/294-keyerror-content-length-on-v127
Download: Set content size only once
2 parents 0a29dbe + 35aebe9 commit b7d097e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ayon_api/server_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,11 @@ def _download_file_to_stream(
13771377
try:
13781378
with get_func(url, **kwargs) as response:
13791379
response.raise_for_status()
1380-
progress.set_content_size(
1381-
response.headers["Content-length"]
1382-
)
1380+
if progress.get_content_size() is None:
1381+
progress.set_content_size(
1382+
response.headers["Content-length"]
1383+
)
1384+
13831385
for chunk in response.iter_content(chunk_size=chunk_size):
13841386
stream.write(chunk)
13851387
progress.add_transferred_chunk(len(chunk))

0 commit comments

Comments
 (0)