Skip to content

Commit

Permalink
added try-catch to flask.send_file
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Mar 4, 2024
1 parent b49c8d7 commit b82cf0c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jarklin/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def files(resource: str):
except Exception as error: # no-fail
logging.error(f"optimization for {resource!r} failed", exc_info=error)

return flask.send_file(fp, as_attachment=as_download)
try:
return flask.send_file(fp, as_attachment=as_download)
except FileNotFoundError:
raise HTTPNotFound(resource)


@app.get("/api/config")
Expand Down

0 comments on commit b82cf0c

Please sign in to comment.