Skip to content

Commit 0bd7978

Browse files
committed
Fix: Files are stored uncompressend when the http server sends gzip encoding header
1 parent ef1a4b7 commit 0bd7978

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bakrep/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ def download(self, id: str, filters: List[dict], target_directory: str):
172172
ds = Dataset.from_dict(json)
173173
results = ds.filter(filters)
174174
for res in results:
175-
r = requests.get(res.url)
175+
r = requests.get(res.url, stream=True)
176176
if not r.ok:
177177
raise DownloadFailedException(id, res.url, r.status_code)
178178
result_url = urllib.parse.urlparse(res.url)
179179
filename = Path(result_url.path).name
180180
target = Path(target_directory) / filename
181-
target.write_bytes(r.content)
181+
target.write_bytes(r.raw.data)

0 commit comments

Comments
 (0)