Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def create_collection3(identifier, domain, page=1, rows=MAX_API_LIMIT):
# Get item metadata
metadata = requests.get('%s/metadata/%s' % (ARCHIVE, identifier)).json()

# Used to build up URIs for the manifest
uri = f"{domain}{identifier}/collection.json"
# Write Collection uri with conditional page segment
uri = f"{domain}{identifier}{f'/{page}' if page != 1 else ''}/collection.json"

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "none"
collection = Collection(id=uri, label=metadata["metadata"]["title"])
Expand Down
5 changes: 5 additions & 0 deletions tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def test_sanitized_summary(self):
f"Expected summary to be sanitized but got: {collection['summary']['none'][0]}"
)

def test_unique_id_sub_page(self):
resp = self.test_app.get("/iiif/usgs_tx/2/collection.json?recache=True")
self.assertEqual(resp.status_code, 200)
collection = resp.json
self.assertEqual(collection['id'], "https://localhost/iiif/usgs_tx/2/collection.json", f"Expected unique ID for the second page of the results but got: {collection['id']}")

if __name__ == '__main__':
unittest.main()
Loading