diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index c6c58828..5df12f44 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -220,9 +220,10 @@ class ValidateJinja2Template(object): f"The following tokens used in the notification are not valid: {undefined}" ) - regex = re.compile('{.*?}') + regex = re.compile('{{(.*?)}}') + valid_tokens = list(notification.valid_tokens.keys()) for p in re.findall(regex, field.data): - if not p.strip('{}') in notification.valid_tokens: + if not p.strip() in valid_tokens: message = field.gettext('Token \'%s\' is not a valid token.') raise ValidationError(message % (p)) diff --git a/changedetectionio/templates/_common_fields.jinja b/changedetectionio/templates/_common_fields.jinja index aa6873ea..765bf34d 100644 --- a/changedetectionio/templates/_common_fields.jinja +++ b/changedetectionio/templates/_common_fields.jinja @@ -85,7 +85,7 @@ The diff output - differences only - {{ '{diff_full}' }} + {{ '{{ diff_full }}' }} The diff output - full difference output