diff --git a/radicale/app/proppatch.py b/radicale/app/proppatch.py index 53ab4822..70bd22e7 100644 --- a/radicale/app/proppatch.py +++ b/radicale/app/proppatch.py @@ -21,9 +21,12 @@ import socket from http import client from xml.etree import ElementTree as ET +import defusedxml.ElementTree as DefusedET + from radicale import app, httputils from radicale import item as radicale_item from radicale import storage, xmlutils +from radicale.hook import HookNotificationItem, HookNotificationItemTypes from radicale.log import logger @@ -112,6 +115,13 @@ class ApplicationProppatchMixin: try: xml_answer = xml_proppatch(base_prefix, path, xml_content, item) + hook_notification_item = HookNotificationItem( + HookNotificationItemTypes.CPATCH, + access.path, + DefusedET.tostring(xml_content, encoding=self._encoding) + .decode(encoding=self._encoding) + ) + self._hook.notify(hook_notification_item) except ValueError as e: logger.warning( "Bad PROPPATCH request on %r: %s", path, e, exc_info=True) diff --git a/radicale/hook/__init__.py b/radicale/hook/__init__.py index 0fc09b42..ed158489 100644 --- a/radicale/hook/__init__.py +++ b/radicale/hook/__init__.py @@ -29,6 +29,7 @@ class BaseHook: class HookNotificationItemTypes(Enum): + CPATCH = "cpatch" UPSERT = "upsert" DELETE = "delete"