From ffbd6f5e7bc9f73af1b9353635057171e087ba80 Mon Sep 17 00:00:00 2001 From: Moritz Kirmse Date: Mon, 13 May 2024 09:26:06 +0200 Subject: [PATCH] undo path substitutions done after upload before the style definition file can be downloaded again. --- geoportal/geoportailv3_geoportal/views/upload.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/geoportal/geoportailv3_geoportal/views/upload.py b/geoportal/geoportailv3_geoportal/views/upload.py index 566f2a9c2..e08aa4065 100644 --- a/geoportal/geoportailv3_geoportal/views/upload.py +++ b/geoportal/geoportailv3_geoportal/views/upload.py @@ -50,12 +50,20 @@ def get_vt_style(self): else: dir = "/tmp" - file_path = os.path.join(dir, '%s.json' %id) + file_path = os.path.join(dir, '%s.json' % id) if not os.path.exists(file_path): return HTTPBadRequest("File does not exist") with open(file_path) as json_file: data = json.load(json_file) + data["glyphs"] = "https://vectortiles.geoportail.lu/fonts/" + data["glyphs"].strip() + for source in data["sources"]: + data["sources"][source]["url"] = ( + data["sources"][source]["url"] + .replace("mbtiles://{", "https://vectortiles.geoportail.lu/data/") + .replace("}", ".json") + ) + return data @view_config(route_name='delete_vt_style', renderer='json')