1
0
Fork 0
mirror of synced 2024-05-28 13:01:12 -04:00
This commit is contained in:
Tingfeng 2022-06-22 20:53:21 +08:00
parent 324947e2f3
commit 8c5e53faba

View file

@ -71,13 +71,9 @@ SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked")
def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
temp_zip_path = path.join(temp_dir, plugin_name)
# Download and extract file in temp dir # Download and extract file in temp dir
with urllib.request.urlopen(zip_path) as req: with urllib.request.urlopen(zip_path) as req:
with open(temp_zip_path, "wb") as f: zip_f = zipfile.ZipFile(BytesIO(req.read()))
f.write(BytesIO(req.read()))
zip_f = zipfile.ZipFile(temp_zip_path)
zip_f.extractall(temp_dir) zip_f.extractall(temp_dir)
content_disp = req.headers.get("Content-Disposition") content_disp = req.headers.get("Content-Disposition")