Fix actual file path reported in error/success message

This commit is contained in:
allegroai 2021-05-03 18:14:56 +03:00
parent cc83aadae6
commit 027edd86bb

View File

@ -59,16 +59,16 @@ def download(path):
@app.route("/<path:path>", methods=["DELETE"]) @app.route("/<path:path>", methods=["DELETE"])
def delete(path): def delete(path):
path = Path( real_path = Path(
safe_join( safe_join(
fspath(app.config["UPLOAD_FOLDER"]), fspath(app.config["UPLOAD_FOLDER"]),
fspath(path) fspath(path)
) )
) )
if not path.exists() or not path.is_file(): if not real_path.exists() or not real_path.is_file():
abort(Response(f"File {str(path)} not found", 404)) abort(Response(f"File {str(path)} not found", 404))
path.unlink() real_path.unlink()
return json.dumps(str(path)), 200 return json.dumps(str(path)), 200