Browse Source

add support for placeholders 'request' and 'to_path'

Peter Bieringer 6 months ago
parent
commit
eec7d5bbbf
1 changed files with 6 additions and 0 deletions
  1. 6 0
      radicale/storage/multifilesystem/lock.py

+ 6 - 0
radicale/storage/multifilesystem/lock.py

@@ -78,10 +78,16 @@ class StoragePartLock(StorageBase):
                     preexec_fn = os.setpgrp
                 # optional argument
                 path = kwargs.get('path', "")
+                request = kwargs.get('request', "NONE")
+                to_path = kwargs.get('to_path', "")
+                if to_path != "":
+                    to_path = shlex.quote(self._get_collection_root_folder() + to_path)
                 try:
                     command = self._hook % {
                         "path": shlex.quote(self._get_collection_root_folder() + path),
+                        "to_path": to_path,
                         "cwd": shlex.quote(self._filesystem_folder),
+                        "request": shlex.quote(request),
                         "user": shlex.quote(user or "Anonymous")}
                 except KeyError as e:
                     logger.error("Storage hook contains not supported placeholder %s (skip execution of: %r)" % (e, self._hook))