From 7c604469464ce343128a6b970823b666965d359d Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 17 May 2024 10:18:31 +0200 Subject: [PATCH] Fix error message on access to restricted zenodo records --- lib/galaxy/files/sources/invenio.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/galaxy/files/sources/invenio.py b/lib/galaxy/files/sources/invenio.py index 99b64cdf5a4e..04df3550c28c 100644 --- a/lib/galaxy/files/sources/invenio.py +++ b/lib/galaxy/files/sources/invenio.py @@ -15,6 +15,7 @@ TypedDict, ) +from galaxy.exceptions import AuthenticationRequired from galaxy.files.sources import ( Entry, EntryData, @@ -406,6 +407,10 @@ def _get_request_headers(self, user_context: OptionalUserContext): return headers def _ensure_response_has_expected_status_code(self, response, expected_status_code: int): + if response.status_code == 403: + raise AuthenticationRequired( + f"Please make sure you have the necessary permissions to access the requested resource." + ) if response.status_code != expected_status_code: error_message = self._get_response_error_message(response) raise Exception(