dlcs / protagonist

MIT License
7 stars 2 forks source link

PathTemplates handles assetPath formatting #902

Closed donaldgray closed 2 months ago

donaldgray commented 2 months ago

Known formatting list only, can be expanded as required.

{assetPath} is a PathTemplate value that can be replaced, this PR adds functionality to handle a format (e.g. {assetPath:3US}). 3US is the only currently supported format, this will replace 3 underscores ___ with a slash /.

This will allow identifiers that contain invalid characters to be reflected back in "id" properties.

Formatting is only supported for assetPath - {customer}, {space} etc left as-is.

assetPath is more than just the "asset" part of the Id, it's the "asset" part and also any asset-delivery parameters. E.g. for /iiif-img/2/1/foo/full/!1024,1024/0/default.jpg it will be foo/full/!1024,1024/0/default.jpg so any path rewrite formatters would need to be aware of this to not collide with IIIF parameters.

A concrete examples is, for an image with Id 2/1/foo___bar-baz being replaced on info.json:

[!WARNING] This is only for asset-delivery paths, auth paths will not use this same rewrite logic.