From 05d4e91856133f0ec6b1730410734ce5f79c4201 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 10 Dec 2024 08:24:41 +0100 Subject: [PATCH] implement umask feature --- radicale/storage/multifilesystem/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radicale/storage/multifilesystem/base.py b/radicale/storage/multifilesystem/base.py index 67071d8e..a8549436 100644 --- a/radicale/storage/multifilesystem/base.py +++ b/radicale/storage/multifilesystem/base.py @@ -145,6 +145,8 @@ class StorageBase(storage.BaseStorage): if os.path.isdir(filesystem_path): return parent_filesystem_path = os.path.dirname(filesystem_path) + if sys.platform != "win32" and self._folder_umask: + oldmask = os.umask(self._config_umask) # Prevent infinite loop if filesystem_path != parent_filesystem_path: # Create parent dirs recursively @@ -152,3 +154,5 @@ class StorageBase(storage.BaseStorage): # Possible race! os.makedirs(filesystem_path, exist_ok=True) self._sync_directory(parent_filesystem_path) + if sys.platform != "win32" and self._folder_umask: + os.umask(oldmask)