Skip to content

Commit

Permalink
add validation using hyperlink setting in the attachment widget
Browse files Browse the repository at this point in the history
configuration (fix #356)
  • Loading branch information
alexbruy committed Mar 24, 2022
1 parent 1aef358 commit a1cc730
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Mergin/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class MerginProjectValidator(object):
ATTACHMENT_ABSOLUTE_PATH = 8, "Attachment widget uses absolute paths"
ATTACHMENT_LOCAL_PATH = 9, "Attachment widget uses local path"
ATTACHMENT_EXPRESSION_PATH = 10, "Attachment widget incorrectly uses expression-based path"
DATABASE_SCHEMA_CHANGE = 11, "Database schema was changed"
ATTACHMENT_HYPERLINK = 11, "Attachment widget uses hyperlink"
DATABASE_SCHEMA_CHANGE = 12, "Database schema was changed"

def __init__(self, mergin_project=None):
self.mp = mergin_project
Expand Down Expand Up @@ -175,6 +176,11 @@ def check_attachment_widget(self):
if expr.isValid():
self.issues[self.ATTACHMENT_EXPRESSION_PATH].append(lid)

# using hyperlinks for document path is not allowed when
if "UseLink" in cfg:
self.issues[self.ATTACHMENT_HYPERLINK].append(lid)


def check_db_schema(self):
for lid, layer in self.layers.items():
if lid not in self.editable:
Expand Down

0 comments on commit a1cc730

Please sign in to comment.