Deleting saved capture folder

This commit is contained in:
Félix Aime 2021-01-28 18:57:35 +01:00
parent 534f847ea7
commit a6c88b7cea

View File

@ -50,11 +50,13 @@ class Save():
if method == "usb":
cd = datetime.now().strftime("%d%m%Y-%H%M")
if shutil.make_archive("{}/TinyCheck_{}".format(self.mount_point, cd), "zip", "/tmp/{}/".format(token)):
shutil.rmtree("/tmp/{}/".format(token))
return jsonify({"status": True,
"message": "Capture saved on the USB key"})
elif method == "url":
cd = datetime.now().strftime("%d%m%Y-%H%M")
if shutil.make_archive("/tmp/TinyCheck_{}".format(cd), "zip", "/tmp/{}/".format(token)):
shutil.rmtree("/tmp/{}/".format(token))
with open("/tmp/TinyCheck_{}.zip".format(cd), "rb") as f:
return send_file(
io.BytesIO(f.read()),