Merge pull request #41 from KasperskyLab/dev

Deleting saved capture folder
This commit is contained in:
Félix Aimé 2021-01-28 19:00:34 +01:00 committed by GitHub
commit 3d52ee83c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()),