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:
Tom Prince
2018-08-15 15:53:27 -06:00
parent 95c3cc7c40
commit 5c3afb34ee

View File

@@ -60,6 +60,9 @@ def stream_download(url, sha256=None, size=None):
t0 = time.time()
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:
chunk = fh.read(65536)
if not chunk: