Skip to content

Commit

Permalink
Merge branch 'master' into resource-types
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell authored May 6, 2024
2 parents 5576710 + 54d80bd commit b4d6d53
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
12 changes: 12 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
Changes
=======

Version 10.3.2 (released 2024-04-30)

- iiif: fix proxy path generation

Version 10.3.1 (released 2024-04-25)

- resources: make IIIF proxy configurable via import string

Version 10.3.0 (released 2024-04-24)

- services: added nested links for record files

Version 10.2.0 (released 2024-04-23)

- iiif: added proxy to image server
Expand Down
2 changes: 1 addition & 1 deletion invenio_rdm_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

from .ext import InvenioRDMRecords

__version__ = "10.2.0"
__version__ = "10.3.2"

__all__ = ("__version__", "InvenioRDMRecords")
3 changes: 2 additions & 1 deletion invenio_rdm_records/fixtures/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (C) 2021-2024 CERN.
# Copyright (C) 2021-2022 Northwestern University.
# Copyright (C) 2024 TU Wien.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -71,7 +72,7 @@ def map_row(self, header, row):
def __iter__(self):
"""Iterate over records."""
with open(self._data_file) as fp:
dialect = csv.Sniffer().sniff(fp.read(1024))
dialect = csv.Sniffer().sniff(fp.read(4096))
fp.seek(0)
reader = csv.reader(fp, dialect)
header = next(reader)
Expand Down
12 changes: 6 additions & 6 deletions invenio_rdm_records/resources/iiif.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class IIIFResourceConfig(ResourceConfig, ConfiguratorMixin):
"tiff": "image/tiff",
}

proxy_cls = FromConfig("IIIF_PROXY_CLASS", default=None)
proxy_cls = FromConfig("IIIF_PROXY_CLASS", default=None, import_string=True)


def with_iiif_content_negotiation(serializer):
Expand Down Expand Up @@ -357,8 +357,8 @@ def _rewrite_url(self):
"""Rewrite URL.
Examples:
- /iiif/record:12:image.png/ -> /iiif/12/__/image.png/
- /iiif/record:1234:image.png/ -> /iiif/12/34_/image.png/
- /iiif/record:12:image.png/ -> /iiif/12/__/_/image.png/
- /iiif/record:1234:image.png/ -> /iiif/12/34/_/image.png/
- /iiif/record:1234567:image.png/ -> /iiif/12/34/567_/image.png/
"""
uuid = resource_requestctx.view_args["uuid"]
Expand All @@ -369,9 +369,9 @@ def _rewrite_url(self):
end_parts = recid_parts[2:]
recid_path = "/".join(start_parts)
if end_parts:
recid_path += f"/{''.join(end_parts)}"
if not recid_path.endswith("_"):
recid_path += "_"
recid_path += f"/{''.join(end_parts)}_"
else:
recid_path += "/_"

path = request.path
path = path.replace(uuid, f"{recid_path}/{filename}.ptif")
Expand Down

0 comments on commit b4d6d53

Please sign in to comment.