Skip to content

Commit

Permalink
check if a .gpkg was deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
harminius committed Jun 5, 2024
1 parent 0d93e60 commit 15d2afc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Mergin/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, warning_id, url=""):
class SingleLayerWarning:
"""Class for warning which is associated with single layer."""

def __init__(self, layer_id, warning, url=""):
def __init__(self, layer_id, warning, url=None):
self.layer_id = layer_id
self.warning = warning
self.url = url
Expand Down Expand Up @@ -402,10 +402,14 @@ def check_editor_perms(self):
self.issues.append(MultipleLayersWarning(Warning.JSON_CONFIG_CHANGE, url))
# check data changes are diff-based not override (e.g. schema change)
for lid, layer in self.layers.items():
if lid not in self.editable:
continue
layer_path = layer.dataProvider().dataSourceUri().split("/")[-1]
url = f"#reset_file?{layer_path}"
if lid not in self.editable:
if any(file["path"] in layer_path for file in self.changes["updated"]):
# layer file deleted
self.issues.append(SingleLayerWarning(lid, Warning.EDITOR_NON_DIFFABLE_CHANGE, url))
else:
continue
dp = layer.dataProvider()
if dp.storageType() == "GPKG":
has_change, msg = has_schema_change(self.mp, layer)
Expand Down

0 comments on commit 15d2afc

Please sign in to comment.