Skip to content

Commit 3d1db12

Browse files
committed
Fixed upgrader context check
1 parent 5d4c896 commit 3d1db12

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/presentation-2/upgrader.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ function descriptiveProperties<T extends Partial<Presentation3.DescriptiveProper
435435
label: resource.label ? convertLanguageMapping(resource.label) : undefined,
436436
requiredStatement: resource.attribution
437437
? {
438-
label: convertLanguageMapping(configuration.attributionLabel),
439-
value: convertLanguageMapping(resource.attribution),
440-
}
438+
label: convertLanguageMapping(configuration.attributionLabel),
439+
value: convertLanguageMapping(resource.attribution),
440+
}
441441
: undefined,
442442
navDate: resource.navDate,
443443
summary: resource.description ? convertLanguageMapping(resource.description) : undefined,
@@ -498,19 +498,18 @@ function linkingProperties(resource: Presentation2.LinkingProperties & Presentat
498498
const related = resource.related ? (Array.isArray(resource.related) ? resource.related : [resource.related]) : [];
499499
const layer = resource.contentLayer as Presentation2.Layer;
500500

501-
502501
return {
503502
provider:
504503
resource.logo || related.length
505504
? [
506-
{
507-
id: configuration.providerId,
508-
type: 'Agent' as const,
509-
homepage: related.length ? [related[0] as any] : undefined,
510-
logo: resource.logo ? (Array.isArray(resource.logo) ? resource.logo : [resource.logo]) : undefined,
511-
label: convertLanguageMapping(configuration.providerName),
512-
},
513-
]
505+
{
506+
id: configuration.providerId,
507+
type: 'Agent' as const,
508+
homepage: related.length ? [related[0] as any] : undefined,
509+
logo: resource.logo ? (Array.isArray(resource.logo) ? resource.logo : [resource.logo]) : undefined,
510+
label: convertLanguageMapping(configuration.providerName),
511+
},
512+
]
514513
: undefined,
515514
partOf: parseWithin(resource),
516515
rendering: resource.rendering,
@@ -598,7 +597,7 @@ function paginationProperties(collection: Presentation2.Collection) {
598597
function removeEmptyItems(resources: any[]) {
599598
const toReturn = [];
600599
for (const originalResource of resources) {
601-
const resource = {...originalResource};
600+
const resource = { ...originalResource };
602601
if (resource.items && resource.items.length === 0) {
603602
delete resource.items;
604603
}
@@ -706,12 +705,12 @@ function upgradeCanvas(canvas: Presentation2.Canvas): Presentation3.Canvas {
706705
items:
707706
canvas.images && canvas.images.length
708707
? [
709-
{
710-
id: mintNewIdFromResource(canvas, 'annotation-page'),
711-
type: 'AnnotationPage',
712-
items: canvas.images as any,
713-
},
714-
]
708+
{
709+
id: mintNewIdFromResource(canvas, 'annotation-page'),
710+
type: 'AnnotationPage',
711+
items: canvas.images as any,
712+
},
713+
]
715714
: undefined,
716715
});
717716
}
@@ -927,7 +926,8 @@ export function convertPresentation2(entity: any): Presentation3.Manifest | Pres
927926
(entity &&
928927
entity['@context'] &&
929928
(entity['@context'] === 'http://iiif.io/api/presentation/2/context.json' ||
930-
entity['@context'].indexOf('http://iiif.io/api/presentation/2/context.json') !== -1 ||
929+
(Array.isArray(entity['@context']) &&
930+
entity['@context'].indexOf('http://iiif.io/api/presentation/2/context.json') !== -1) ||
931931
// Yale context.
932932
entity['@context'] === 'http://www.shared-canvas.org/ns/context.json')) ||
933933
entity['@context'] === 'http://iiif.io/api/image/2/context.json' ||

0 commit comments

Comments
 (0)