From 94e140e685baae38e8977fe90a3304bbc041ae66 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 11 Oct 2022 10:39:50 +0200 Subject: [server] restore compatibility with flask 1.1 --- src/hydrilla/server/serve.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py index 7c9789a..00682aa 100644 --- a/src/hydrilla/server/serve.py +++ b/src/hydrilla/server/serve.py @@ -141,10 +141,17 @@ 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 + + if flask.__version__[0:2] in ('0.', '1.'): + caching_args = {'add_etags': False, 'cache_timeout': 0} + else: + caching_args = {'etag': False} + return flask.send_file( str(file_path), - mimetype = 'application/json', - etag = False + mimetype = 'application/json', + conditional = False, + **caching_args # type: ignore ) @bp.route('/mapping/') -- cgit v1.2.3