mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 14:04:23 +00:00
Search: Fix GZip decompression code
This commit is contained in:
parent
51b3a5164d
commit
eb159c0b18
@ -85,9 +85,9 @@ def download_file(url, referer=None):
|
|||||||
response = urllib.request.urlopen(req)
|
response = urllib.request.urlopen(req)
|
||||||
dat = response.read()
|
dat = response.read()
|
||||||
# Check if it is gzipped
|
# Check if it is gzipped
|
||||||
if dat[:2] == '\037\213':
|
if dat[:2] == b'\x1f\x8b':
|
||||||
# Data is gzip encoded, decode it
|
# Data is gzip encoded, decode it
|
||||||
compressedstream = io.StringIO(dat)
|
compressedstream = io.BytesIO(dat)
|
||||||
gzipper = gzip.GzipFile(fileobj=compressedstream)
|
gzipper = gzip.GzipFile(fileobj=compressedstream)
|
||||||
extracted_data = gzipper.read()
|
extracted_data = gzipper.read()
|
||||||
dat = extracted_data
|
dat = extracted_data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user