1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-28 19:40:54 +00:00

implement umask feature

This commit is contained in:
Peter Bieringer 2024-12-10 08:24:41 +01:00
parent 99b6889d91
commit 05d4e91856

View file

@ -145,6 +145,8 @@ class StorageBase(storage.BaseStorage):
if os.path.isdir(filesystem_path): if os.path.isdir(filesystem_path):
return return
parent_filesystem_path = os.path.dirname(filesystem_path) 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 # Prevent infinite loop
if filesystem_path != parent_filesystem_path: if filesystem_path != parent_filesystem_path:
# Create parent dirs recursively # Create parent dirs recursively
@ -152,3 +154,5 @@ class StorageBase(storage.BaseStorage):
# Possible race! # Possible race!
os.makedirs(filesystem_path, exist_ok=True) os.makedirs(filesystem_path, exist_ok=True)
self._sync_directory(parent_filesystem_path) self._sync_directory(parent_filesystem_path)
if sys.platform != "win32" and self._folder_umask:
os.umask(oldmask)