Skip to content

Commit

Permalink
iiif: updated configuration
Browse files Browse the repository at this point in the history
* Updated configuration to use the new
`RDM_IIIF_SERVER_URL` variable.
* Updated server image path to include only public
files.
  • Loading branch information
alejandromumo authored and slint committed Apr 22, 2024
1 parent e47d0b7 commit 19ecf1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion invenio_rdm_records/resources/iiif.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ def proxied_routes(self):

def proxy_request(self):
"""Proxy request to IIIF server."""
assert (
self.server_url
), "IIIF server URL must be set. Use variable `RDM_IIIF_SERVER_URL` to set it."

url = self.handle_url_rewrite()
res = requests.request(
request.method, url, headers=request.headers, stream=True
Expand All @@ -335,7 +339,7 @@ def handle_url_rewrite(self):
recid = uuid.split(":")[1]
file_name = uuid.split(":")[-1]
path = request.path
path = path.replace("/iiif/", "").replace(uuid, f"public/{recid}/{file_name}")
path = path.replace(uuid, f"/public/{recid}/{file_name}")
return urljoin(
self.server_url,
path,
Expand Down

0 comments on commit 19ecf1c

Please sign in to comment.