mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-23 08:31:05 +00:00
Fix incorrect path to zip file to unzip; improve error handling
This commit is contained in:
parent
c706fedfd3
commit
dd6d289395
@ -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