- Check if hook is enabled before constructing hook notification items

- Skip/early exit email hook if notification item is not a VCALENDAR
This commit is contained in:
Nate Harris
2026-03-30 01:55:03 -06:00
parent 89edf01757
commit 3b9df7b87e
7 changed files with 123 additions and 61 deletions

View File

@@ -205,15 +205,17 @@ class ApplicationPartProppatch(ApplicationBase):
xml_content,
encoding=self._encoding
).decode(encoding=self._encoding)
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.CPATCH,
path=access.path,
content=content,
uid=None,
old_content=None,
new_content=content
)
self._hook.notify(hook_notification_item)
if self._hook.enabled:
hook_notification_item = HookNotificationItem(
notification_item_type=HookNotificationItemTypes.CPATCH,
path=access.path,
content=content,
content_type=None, # Can't easily determine content type, won't trigger email hook
uid=None,
old_content=None,
new_content=content
)
self._hook.notify(hook_notification_item)
except ValueError as e:
# return better matching HTTP result in case errno is provided and catched
errno_match = re.search("\\[Errno ([0-9]+)\\]", str(e))