internetarchive / iiif

The official Internet Archive IIIF service
GNU General Public License v3.0
21 stars 4 forks source link

Collections routes need redirect #15

Closed hadro closed 10 months ago

hadro commented 11 months ago

As identified on the IIIF Slack following the IIIF/IA community call, we're missing a redirect route for collections manifest generation to match the routing we do for regular manifest generation.

I believe the following additions to app.py should cover it, but I welcome review by others:

@app.route('/iiif/<identifier>/collection.json')
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def collection(identifier):
    return redirect(f'/iiif/3/{identifier}/collection.json', code=302)

@app.route('/iiif/<identifier>/<page>/collection.json')
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def collectionPage(identifier, page):
    return redirect(f'/iiif/3/{identifier}/{page}/collection.json', code=302)
glenrobson commented 11 months ago

Enhancement:

Add check if metadata type="collection" then redirect to collection.json as a helper in case someone has asked for a manifest.json for a colleciton .

digitaldogsbody commented 11 months ago

I've added the redirects - but I will discuss it at the call this evening, as we don't actually do a redirect for the manifests, just serve the version with /3/ from the unversioned endpoint

digitaldogsbody commented 11 months ago

Also added the redirect from manifest.json -> collection.json when appropriate