-
Notifications
You must be signed in to change notification settings - Fork 2
Description
When attempting to load the thumbnail for the Manifest at https://iiif.io/api/cookbook/recipe/0033-choice/manifest.json, getBestThumbnailAtSize is unable to find one:
https://codesandbox.io/s/vault-helpers-forked-lwux3g
I assume it's due to the fact that the Manifest's sole Canvas has an Annotation with a Choice body that has two different images.
Looking through the code, it seems to me that getBestThumbnailAtSize is missing a level of recursion. When it encounters an Annotation, it assumes that the first body item is an Image that can be passed to imageServiceLoader.getThumbnailFromResource: https://github.com/IIIF-Commons/vault-helpers/blob/8a14efa1fdaf2e31f87a926e515efb7bf3631bc3/src/thumbnail.ts#L72-L88
I think it should instead check the type of the body item and recurse if it's a Choice, so it will hit the branch at https://github.com/IIIF-Commons/vault-helpers/blob/8a14efa1fdaf2e31f87a926e515efb7bf3631bc3/src/thumbnail.ts#L113-L117, which should do the right thing.