mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
Merge pull request #18169 from davelopez/24.0_fix_invenio_restricted_access_message
[24.0] Fix error message when accessing restricted Zenodo records
This commit is contained in:
@@ -15,6 +15,7 @@ from typing_extensions import (
|
||||
TypedDict,
|
||||
)
|
||||
|
||||
from galaxy.exceptions import AuthenticationRequired
|
||||
from galaxy.files.sources import (
|
||||
Entry,
|
||||
EntryData,
|
||||
@@ -406,6 +407,9 @@ class InvenioRepositoryInteractor(RDMRepositoryInteractor):
|
||||
return headers
|
||||
|
||||
def _ensure_response_has_expected_status_code(self, response, expected_status_code: int):
|
||||
if response.status_code == 403:
|
||||
record_url = response.url.replace("/api", "").replace("/files", "")
|
||||
raise AuthenticationRequired(f"Please make sure you have the necessary permissions to access: {record_url}")
|
||||
if response.status_code != expected_status_code:
|
||||
error_message = self._get_response_error_message(response)
|
||||
raise Exception(
|
||||
|
||||
Reference in New Issue
Block a user