mirror of
1
0
Fork 0
This commit is contained in:
Tingfeng 2022-06-22 20:51:29 +08:00
parent 14906f26a0
commit 324947e2f3
1 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import shutil
import tempfile
import urllib.request
import zipfile
from io import BytesIO
from os import path
# --- Globals ----------------------------------------------
@ -75,7 +76,7 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir):
# Download and extract file in temp dir
with urllib.request.urlopen(zip_path) as req:
with open(temp_zip_path, "wb") as f:
f.write(req.read())
f.write(BytesIO(req.read()))
zip_f = zipfile.ZipFile(temp_zip_path)
zip_f.extractall(temp_dir)
content_disp = req.headers.get("Content-Disposition")