mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1343718 - Don't display download progress when we don't know the download size in advance. r=chmanchester
In most cases, the HTTP response for the download will contain the content-length, but if some error happens (e.g. authentication error), there might not be one, and the download fails with a TypeError for a division by None, instead of failing with a more friendly error message about the HTTP error. --HG-- extra : rebase_source : f179142e69c9ca09b05ad2ff942753fd84da6a69
This commit is contained in:
parent
2f47399ef6
commit
a07b022268
@ -718,6 +718,8 @@ class ArtifactCache(CacheManager):
|
||||
dl = self._download_manager.download(url, fname)
|
||||
|
||||
def download_progress(dl, bytes_so_far, total_size):
|
||||
if not total_size:
|
||||
return
|
||||
percent = (float(bytes_so_far) / total_size) * 100
|
||||
now = int(percent / 5)
|
||||
if now == self._last_dl_update:
|
||||
|
Loading…
Reference in New Issue
Block a user