Skip to content

Commit

Permalink
Update api.py (#17)
Browse files Browse the repository at this point in the history
* Update api.py

Fix #16

* Update api.py

Closes #18

* Added minimum flask version to setup.py
  • Loading branch information
steffenfritz authored Oct 16, 2022
1 parent 999f87a commit 86ffdd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions netviel/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

import bleach
import notmuch
from flask import Flask, current_app, g, send_file, send_from_directory, safe_join
from flask import Flask, current_app, g, send_file, send_from_directory
from flask_cors import CORS
from flask_restful import Api, Resource

from werkzeug.utils import safe_join

ALLOWED_TAGS = [
"a",
"abbr",
Expand Down Expand Up @@ -126,7 +128,7 @@ def download_message(message_id):
msgs = notmuch.Query(get_db(), "mid:{}".format(message_id)).search_messages()
msg = next(msgs) # there can be only 1
return send_file(msg.get_filename(), mimetype="message/rfc822",
as_attachment=True, attachment_filename=message_id+".eml")
as_attachment=True, download_name=message_id+".eml")

return app

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
license="MIT",
packages=find_packages(),
package_data={"netviel": PACKAGE_DATA},
install_requires=["flask", "flask-cors", "flask-restful", "bleach"],
install_requires=["flask>=2.1.0", "flask-cors", "flask-restful", "bleach"],
)

0 comments on commit 86ffdd3

Please sign in to comment.