Skip to content

Commit

Permalink
only allow file download if the file has been created in the database…
Browse files Browse the repository at this point in the history
… first
  • Loading branch information
afourmy committed Mar 11, 2024
1 parent 90a3973 commit 1b27430
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eNMS/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ def view_service_results(run_id, service):
@blueprint.route("/download/<type>/<path:path>")
@self.process_requests
def download(type, path):
db_file = db.fetch(type, path=path, allow_none=True)
if not db_file:
return {"error": "File not found in database."}
return_data, full_path = BytesIO(), f"{vs.file_path}/{path}"
if type == "folder":
with open_tar(f"{full_path}.tgz", "w:gz") as tar:
Expand Down

0 comments on commit 1b27430

Please sign in to comment.