mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-23 21:29:30 +00:00
Merge pull request #375 from akuker/fix_unzipping
Fix incorrect path to zip file to unzip; improve error handling
This commit is contained in:
commit
4474f1ddaa
@ -146,13 +146,13 @@ def unzip_file(file_name):
|
||||
|
||||
unzip_proc = run(
|
||||
["unzip", "-d", server_info["image_dir"], "-o", "-j", \
|
||||
server_info["image_dir"] + file_name], capture_output=True
|
||||
f"{server_info['image_dir']}/{file_name}"], capture_output=True
|
||||
)
|
||||
if unzip_proc.returncode != 0:
|
||||
logging.warning(f"Unzipping failed: {unzip_proc}")
|
||||
return {"status": False, "msg": unzip_proc}
|
||||
return {"status": False, "msg": str(unzip_proc)}
|
||||
|
||||
return {"status": True, "msg": f"{file_name} unzipped"}
|
||||
return {"status": True, "msg": f"Unzipped {file_name} to {server_info['image_dir']}"}
|
||||
|
||||
|
||||
def download_file_to_iso(scsi_id, url):
|
||||
|
@ -638,11 +638,13 @@ def delete():
|
||||
def unzip():
|
||||
image = request.form.get("image")
|
||||
|
||||
if unzip_file(image):
|
||||
flash("Unzipped file " + image)
|
||||
process = unzip_file(image)
|
||||
if process["status"]:
|
||||
flash(process["msg"])
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
flash("Failed to unzip " + image, "error")
|
||||
flash(process["msg"], "error")
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user