From 1fb0adde547937ca1fd343bbd8f787add2749b04 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 4 Dec 2024 18:08:52 +0100 Subject: [PATCH] Notifications - Support for commented out notification URLs (#2825 #2769) --- changedetectionio/forms.py | 8 ++++++-- changedetectionio/notification.py | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 121b44580d7..11792d6225c 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -308,8 +308,12 @@ def __call__(self, form, field): # so that the custom endpoints are registered from changedetectionio.apprise_plugin import apprise_custom_api_call_wrapper for server_url in field.data: - if not apobj.add(server_url): - message = field.gettext('\'%s\' is not a valid AppRise URL.' % (server_url)) + url = server_url.strip() + if url.startswith("#"): + continue + + if not apobj.add(url): + message = field.gettext('\'%s\' is not a valid AppRise URL.' % (url)) raise ValidationError(message) class ValidateJinja2Template(object): diff --git a/changedetectionio/notification.py b/changedetectionio/notification.py index a7328857315..42dcdce7341 100644 --- a/changedetectionio/notification.py +++ b/changedetectionio/notification.py @@ -79,6 +79,10 @@ def process_notification(n_object, datastore): n_title = jinja_render(template_str=n_object.get('notification_title', ''), **notification_parameters) url = url.strip() + if url.startswith('#'): + logger.trace(f"Skipping commented out notification URL - {url}") + continue + if not url: logger.warning(f"Process Notification: skipping empty notification URL.") continue