Skip to content

Commit

Permalink
undo path substitutions done after upload before the style definition…
Browse files Browse the repository at this point in the history
… file can be downloaded again.
  • Loading branch information
mki-c2c committed May 13, 2024
1 parent c862c47 commit ffbd6f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion geoportal/geoportailv3_geoportal/views/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit ffbd6f5

Please sign in to comment.