storage/get+discover: only add items not exceeding max-resource-size

This commit is contained in:
Peter Bieringer
2026-03-26 07:56:38 +01:00
parent e55ccefeb3
commit 24c0832762
2 changed files with 6 additions and 3 deletions

View File

@@ -77,7 +77,8 @@ class StoragePartDiscover(StorageBase):
if href: if href:
item = collection._get(href) item = collection._get(href)
if item is not None: if item is not None:
yield item if pathutils.file_check_size(filesystem_path, self._max_resource_size):
yield item
return return
yield collection yield collection

View File

@@ -175,7 +175,8 @@ class CollectionPartGet(CollectionPartCache, CollectionPartLock,
href) href)
yield (href, None) yield (href, None)
else: else:
yield (href, self._get(href, verify_href=False)) if pathutils.file_check_size(path, self._storage._max_resource_size):
yield (href, self._get(href, verify_href=False))
def get_all(self) -> Iterator[radicale_item.Item]: def get_all(self) -> Iterator[radicale_item.Item]:
for href in self._list(): for href in self._list():
@@ -183,4 +184,5 @@ class CollectionPartGet(CollectionPartCache, CollectionPartLock,
# are from os.listdir. # are from os.listdir.
item = self._get(href, verify_href=False) item = self._get(href, verify_href=False)
if item is not None: if item is not None:
yield item if pathutils.file_check_size(os.path.join(self._filesystem_path, href), self._storage._max_resource_size):
yield item