diff --git a/oarepo_ui/resources/components/files.py b/oarepo_ui/resources/components/files.py index 7d3a5e30..d46c81a5 100644 --- a/oarepo_ui/resources/components/files.py +++ b/oarepo_ui/resources/components/files.py @@ -1,3 +1,5 @@ +from invenio_records_resources.services.errors import PermissionDeniedError + from oarepo_runtime.datastreams.utils import get_file_service_for_record_service from .base import UIResourceComponent @@ -13,8 +15,14 @@ def before_ui_edit(self, *, api_record, extra_context, identity, **kwargs): file_service = get_file_service_for_record_service( self.resource.api_service, record=api_record ) - files = file_service.list_files(identity, api_record["id"]) - extra_context["files"] = files.to_dict() + try: + files = file_service.list_files(identity, api_record["id"]) + extra_context["files"] = files.to_dict() + except PermissionDeniedError: + extra_context["files"] = { + "entries": [], + "links": {} + } def before_ui_detail(self, **kwargs): self.before_ui_edit(**kwargs) diff --git a/setup.cfg b/setup.cfg index 5f660228..10dab96b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-ui -version = 5.2.28 +version = 5.2.29 description = UI module for invenio 3.5+ long_description = file: README.md long_description_content_type = text/markdown