Bug 1484012: [fetch-content] Transparently decompress artifacts; r=gps
generic-worker transparently compresses uncompressed artifacts. Teach fetch-content to decompress those artifacts. Differential Revision: https://phabricator.services.mozilla.com/D3555
This commit is contained in:
@@ -60,6 +60,9 @@ def stream_download(url, sha256=None, size=None):
|
|||||||
|
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
with urllib.request.urlopen(url) as fh:
|
with urllib.request.urlopen(url) as fh:
|
||||||
|
if not url.endswith('.gz') and fh.info().get('Content-Encoding') == 'gzip':
|
||||||
|
fh = gzip.GzipFile(fileobj=fh)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
chunk = fh.read(65536)
|
chunk = fh.read(65536)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
|
|||||||
Reference in New Issue
Block a user