1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-13 18:50:53 +00:00

add support for placeholders 'request' and 'to_path'

This commit is contained in:
Peter Bieringer 2025-08-12 16:09:11 +02:00
parent cdfee329db
commit eec7d5bbbf

View file

@ -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))