aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-10 10:20:08 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-10 10:20:08 +0200
commit51dda0db902bec61cd8b76ed10d5c4b03694d285 (patch)
tree3f22583cb783db839544e6a863b4a999686ff9fc /src/hydrilla
parentea3300de1269c1c2e1fe76f6a6dec534936cc303 (diff)
downloadhaketilo-hydrilla-51dda0db902bec61cd8b76ed10d5c4b03694d285.tar.gz
haketilo-hydrilla-51dda0db902bec61cd8b76ed10d5c4b03694d285.zip
[server] prevent incorrect caching of JSONs served by Hydrilla
Diffstat (limited to 'src/hydrilla')
-rw-r--r--src/hydrilla/server/serve.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index e6ba484..4e2eb00 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -141,7 +141,11 @@ def get_resource_or_mapping(item_type: str, identifier: str) \
# no need for send_from_directory(); path is safe, constructed by us
info_path = f'{info.identifier}/{versions.version_string(info.version)}'
file_path = get_malcontent().malcontent_dir_path / item_type / info_path
- return flask.send_file(open(file_path, 'rb'), mimetype='application/json')
+ return flask.send_file(
+ str(file_path),
+ mimetype = 'application/json',
+ etag = False
+ )
@bp.route('/mapping/<string:identifier_dot_json>')
def get_newest_mapping(identifier_dot_json: str) -> werkzeug.Response: