fix(iiif): validate expected shape of identifiers#2234
fix(iiif): validate expected shape of identifiers#2234max-moser wants to merge 2 commits intoinveniosoftware:masterfrom
Conversation
c4b215d to
0628519
Compare
|
|
||
| We assume the uuid is build as ``<record|draft>:<pid_value>``. | ||
| """ | ||
| type_, id_ = uuid.split(":", 1) |
There was a problem hiding this comment.
remove the maxsplit argument to have a more accurate reading of the number of separator colons in the full string
this could be an issue if pid_value was allowed to have a colon inside it, which is not the case for RECIDs out of the box
if they do, the _iiif_image_uuid() check might be even worse off
|
|
||
| We assume the uuid is build as ``<record|draft>:<pid_value>:<key>``. | ||
| """ | ||
| type_, id_, key = uuid.split(":", 2) |
There was a problem hiding this comment.
perhaps the maxsplit argument should be added back here, because the key might be allowed to have colons in it?
then (with maxsplit), the key could have as few/many colons as desired; but pid_value still cannot be allowed to have colons (because otherwise we can't reliably determine pid_value vs. key)
There was a problem hiding this comment.
I don't think we do any kind of validation on the file key. It might be a good idea to add maxsplit back on this one.
0628519 to
0f5115d
Compare
* identifiers mismatching the expectations about the number of separator colons
0f5115d to
6bd35a6
Compare
* validate if the requested identifier matches the expected shape, and raise a new dedicated error type if that is not the case
6bd35a6 to
28a253e
Compare
|
This PR was automatically marked as stale. |
Some IIIF API endpoints expect passed identifiers to have a specific shape (either two or three separator colons).
Currently, this is not validated beyond a simple
id.split(":")which causes a 500 internal server error if the identifier doesn't match the expected shape.This PR introduces a new exception type that indicates the case that an identifier did not match the expected shape.