sharing/report: add missing backmap
This commit is contained in:
@@ -255,7 +255,7 @@ def xml_report(base_prefix: str, path: str, xml_request: Optional[ET.Element],
|
|||||||
|
|
||||||
# Retrieve everything required for finishing the request.
|
# Retrieve everything required for finishing the request.
|
||||||
retrieved_items = list(retrieve_items(
|
retrieved_items = list(retrieve_items(
|
||||||
base_prefix, path, collection, hreferences, main_filters, multistatus))
|
base_prefix, path, collection, hreferences, main_filters, multistatus, share))
|
||||||
collection_tag = collection.tag
|
collection_tag = collection.tag
|
||||||
# !!! Don't access storage after this !!!
|
# !!! Don't access storage after this !!!
|
||||||
unlock_storage_fn()
|
unlock_storage_fn()
|
||||||
@@ -743,19 +743,22 @@ def xml_item_response(base_prefix: str, href: str,
|
|||||||
def retrieve_items(
|
def retrieve_items(
|
||||||
base_prefix: str, path: str, collection: storage.BaseCollection,
|
base_prefix: str, path: str, collection: storage.BaseCollection,
|
||||||
hreferences: Iterable[str], filters: Sequence[ET.Element],
|
hreferences: Iterable[str], filters: Sequence[ET.Element],
|
||||||
multistatus: ET.Element) -> Iterator[Tuple[radicale_item.Item, bool]]:
|
multistatus: ET.Element, share: Union[dict | None]) -> Iterator[Tuple[radicale_item.Item, bool]]:
|
||||||
"""Retrieves all items that are referenced in ``hreferences`` from
|
"""Retrieves all items that are referenced in ``hreferences`` from
|
||||||
``collection`` and adds 404 responses for missing and invalid items
|
``collection`` and adds 404 responses for missing and invalid items
|
||||||
to ``multistatus``."""
|
to ``multistatus``."""
|
||||||
collection_requested = False
|
collection_requested = False
|
||||||
|
|
||||||
def get_names() -> Iterator[str]:
|
def get_names(share: Union[dict | None]) -> Iterator[str]:
|
||||||
"""Extracts all names from references in ``hreferences`` and adds
|
"""Extracts all names from references in ``hreferences`` and adds
|
||||||
404 responses for invalid references to ``multistatus``.
|
404 responses for invalid references to ``multistatus``.
|
||||||
If the whole collections is referenced ``collection_requested``
|
If the whole collections is referenced ``collection_requested``
|
||||||
gets set to ``True``."""
|
gets set to ``True``."""
|
||||||
nonlocal collection_requested
|
nonlocal collection_requested
|
||||||
for hreference in hreferences:
|
for hreference in hreferences:
|
||||||
|
if share:
|
||||||
|
# map back to owner
|
||||||
|
hreference = hreference.replace(share['PathOrToken'], share['PathMapped'])
|
||||||
try:
|
try:
|
||||||
name = pathutils.name_from_path(hreference, collection)
|
name = pathutils.name_from_path(hreference, collection)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@@ -772,7 +775,7 @@ def retrieve_items(
|
|||||||
# Reference is a collection
|
# Reference is a collection
|
||||||
collection_requested = True
|
collection_requested = True
|
||||||
|
|
||||||
for name, item in collection.get_multi(get_names()):
|
for name, item in collection.get_multi(get_names(share)):
|
||||||
if not item:
|
if not item:
|
||||||
uri = pathutils.unstrip_path(posixpath.join(collection.path, name))
|
uri = pathutils.unstrip_path(posixpath.join(collection.path, name))
|
||||||
response = xml_item_response(base_prefix, uri, found_item=False)
|
response = xml_item_response(base_prefix, uri, found_item=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user