Fix filesystem folder creation

This commit is contained in:
Unrud 2020-01-15 06:38:32 +01:00
parent 41a91f7da1
commit 1bd93a2947
6 changed files with 10 additions and 9 deletions

View File

@ -115,9 +115,9 @@ class Storage(
_collection_class = Collection _collection_class = Collection
def __init__(self, configuration): def __init__(self, configuration):
super().__init__(configuration)
folder = configuration.get("storage", "filesystem_folder") folder = configuration.get("storage", "filesystem_folder")
self._makedirs_synced(folder) self._makedirs_synced(folder)
super().__init__(configuration)
def _get_collection_root_folder(self): def _get_collection_root_folder(self):
filesystem_folder = self.configuration.get( filesystem_folder = self.configuration.get(

View File

@ -24,9 +24,6 @@ from radicale import pathutils
class StorageCreateCollectionMixin: class StorageCreateCollectionMixin:
def __init__(self, configuration):
super().__init__(configuration)
def create_collection(self, href, items=None, props=None): def create_collection(self, href, items=None, props=None):
folder = self._get_collection_root_folder() folder = self._get_collection_root_folder()

View File

@ -26,9 +26,6 @@ from radicale.log import logger
class StorageDiscoverMixin: class StorageDiscoverMixin:
def __init__(self, configuration):
super().__init__(configuration)
def discover(self, path, depth="0", child_context_manager=( def discover(self, path, depth="0", child_context_manager=(
lambda path, href=None: contextlib.ExitStack())): lambda path, href=None: contextlib.ExitStack())):
# Path should already be sanitized # Path should already be sanitized

View File

@ -39,6 +39,7 @@ class CollectionLockMixin:
class StorageLockMixin: class StorageLockMixin:
def __init__(self, configuration): def __init__(self, configuration):
super().__init__(configuration) super().__init__(configuration)
folder = self.configuration.get("storage", "filesystem_folder") folder = self.configuration.get("storage", "filesystem_folder")

View File

@ -22,8 +22,6 @@ from radicale import pathutils
class StorageMoveMixin: class StorageMoveMixin:
def __init__(self, configuration):
super().__init__(configuration)
def move(self, item, to_collection, to_href): def move(self, item, to_collection, to_href):
if not pathutils.is_safe_filesystem_path_component(to_href): if not pathutils.is_safe_filesystem_path_component(to_href):

View File

@ -1487,6 +1487,14 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
"""Test BaseRequests on multifilesystem.""" """Test BaseRequests on multifilesystem."""
storage_type = "multifilesystem" storage_type = "multifilesystem"
def test_folder_creation(self):
"""Verify that the folder is created."""
folder = os.path.join(self.colpath, "subfolder")
self.configuration.update({"storage": {"filesystem_folder": folder}},
"test")
self.application = Application(self.configuration)
assert os.path.isdir(folder)
def test_fsync(self): def test_fsync(self):
"""Create a directory and file with syncing enabled.""" """Create a directory and file with syncing enabled."""
self.configuration.update({ self.configuration.update({