mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
fix: do not fail when trying to read metadata of a missing geojson
Some geojson have been removed by mistake time ago (cf #1003), when someone tries to load a map referencing them, it was until recently just showing an error message, but since recently we try to get the metadata from it, and this will crash.
This commit is contained in:
parent
64c7fe1ec9
commit
41264e740f
1 changed files with 4 additions and 1 deletions
|
@ -526,7 +526,10 @@ class DataLayer(NamedModel):
|
|||
metadata = self.settings
|
||||
if not metadata:
|
||||
# Fallback to file for old datalayers.
|
||||
data = json.loads(self.geojson.read().decode())
|
||||
try:
|
||||
data = json.loads(self.geojson.read().decode())
|
||||
except FileNotFoundError:
|
||||
data = {}
|
||||
metadata = data.get("_umap_options")
|
||||
if not metadata:
|
||||
metadata = {
|
||||
|
|
Loading…
Reference in a new issue