Skip to content

Commit

Permalink
views: FAIR signposting level 1 support (handle disabled files)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptamarit committed Dec 10, 2024
1 parent 0042190 commit 15672de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions invenio_app_rdm/records_ui/views/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 15672de

Please sign in to comment.