From 4780f82908cb8bc696b332e2d6c31b72ebb2c823 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Sat, 24 Oct 2020 13:43:18 +0200 Subject: [PATCH] TT#7211 fix repoapi.utils.dlfile, it was storing gzip responses content All files were stored as gzip, since that is what nginx was sending Change-Id: Ic999deaa2a073364db49eb5534e103b25d23704c --- repoapi/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/repoapi/utils.py b/repoapi/utils.py index ce1a2e9..3dfe581 100644 --- a/repoapi/utils.py +++ b/repoapi/utils.py @@ -15,7 +15,6 @@ import logging import os import re -import shutil import subprocess from distutils.dir_util import mkpath @@ -59,9 +58,10 @@ def dlfile(url, path): settings.JENKINS_HTTP_USER, settings.JENKINS_HTTP_PASSWD ) logger.debug("url:[%s]", url) - with requests.get(url, auth=auth, stream=True) as req: - with open(path, "wb") as local_file: - shutil.copyfileobj(req.raw, local_file) + req = requests.get(url, auth=auth) + with open(path, "wb") as local_file: + for chunk in req.iter_content(chunk_size=128): + local_file.write(chunk) def open_jenkins_url(url):