Fix filesystem folder creation
This commit is contained in:
parent
41a91f7da1
commit
1bd93a2947
@ -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(
|
||||||
|
@ -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()
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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")
|
||||||
|
@ -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):
|
||||||
|
@ -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({
|
||||||
|
Loading…
Reference in New Issue
Block a user