Allow for IIIF 2 image profile to be a string instead of a list

While the IIIF Image API 2 spec requires `profile` to be a list with a compliance level URI as first entry, some image servers just set `profile` to a string with the URI as value.
This commit is contained in:
Lutz Helm 2019-01-23 12:34:30 +01:00
parent 5334533d94
commit e54189984f
1 changed files with 6 additions and 0 deletions

View File

@ -412,6 +412,12 @@ dlfUtils.iiifProfiles = {
*/
dlfUtils.buildImageV2 = function buildImageV2(mimetype, uri, jsonld) {
if (typeof jsonld.profile == "string") {
jsonld.profile = [jsonld.profile, {}];
}
if (jsonld.profile !== undefined && jsonld.profile.length < 2) {
jsonld.profile.push({});
}
var levelProfile = jsonld.profile === undefined || dlfUtils.iiifProfiles[jsonld.profile[0]] === undefined ? dlfUtils.iiifProfiles['none'] : dlfUtils.iiifProfiles[jsonld.profile[0]];
return {
src: uri,