PathTemplates handles assetPath formatting #902
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 befoo/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:/{prefix}/{customer}/{space}/{assetPath}
=>/iiif-img/2/1/foo___bar-baz/info.json
/{prefix}/ark:{assetPath:3US}
=>/iiif-img/ark:foo/bar-baz/info.json
Warning
This is only for asset-delivery paths, auth paths will not use this same rewrite logic.