Skip to content

Commit

Permalink
Notifications - Support for commented out notification URLs (#2825 #2769
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dgtlmoon authored Dec 4, 2024
1 parent 2614b27 commit 1fb0add
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions changedetectionio/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fb0add

Please sign in to comment.