From 15672de075d1790171e6f7f93c60f51f4332faf2 Mon Sep 17 00:00:00 2001 From: Pablo Tamarit Date: Tue, 10 Dec 2024 16:33:11 +0100 Subject: [PATCH] views: FAIR signposting level 1 support (handle disabled files) --- invenio_app_rdm/records_ui/views/decorators.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/invenio_app_rdm/records_ui/views/decorators.py b/invenio_app_rdm/records_ui/views/decorators.py index 1947b0b5e..c808a2bea 100644 --- a/invenio_app_rdm/records_ui/views/decorators.py +++ b/invenio_app_rdm/records_ui/views/decorators.py @@ -438,12 +438,14 @@ def _get_signposting_licenses(record): def _get_signposting_items(files, pid_value): items = [] - # Checking if the user has access to the files. + # Checking if the user has access to the potentially restricted files. if files: # Limiting the iteration to 100 files maximum. - for file in islice(files.to_dict()["entries"], 0, 100): + # The `entries` key does not exist if files are not enabled. + for file in islice(files.to_dict().get("entries", []), 0, 100): url = download_url_for(pid_value=pid_value, filename=file["key"]) items.append(_get_header("item", url, file["mimetype"])) + return items