Skip to content

Commit cb9fd0b

Browse files
glorieux-fcdrini
andauthored
Fix IIIF plugin missing last page + erroring when metadata unspecified (#1349)
Co-authored-by: Drini Cami <cdrini@gmail.com>
1 parent a9c279c commit cb9fd0b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/plugins/plugin.iiif.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class IIIFPlugin {
3535
bookTitle: resolveInternationalString(manifest.label),
3636
pageProgression: manifest.viewingDirection == "right-to-left" ? "rl" : "lr",
3737
// numLeafs: manifest.items.length,
38-
metadata: manifest.metadata.map((metadata) => {
38+
metadata: (manifest.metadata || []).map((metadata) => {
3939
return {
4040
label: resolveInternationalString(metadata.label),
4141
value: resolveInternationalString(metadata.value),
@@ -76,7 +76,9 @@ class IIIFPlugin {
7676
spread = [];
7777
}
7878
});
79-
79+
if (spread.length > 0) {
80+
book.data.push(spread);
81+
}
8082
return book;
8183
}
8284

@@ -116,7 +118,9 @@ class IIIFPlugin {
116118
spread = [];
117119
}
118120
});
119-
121+
if (spread.length > 0) {
122+
book.data.push(spread);
123+
}
120124
return book;
121125
}
122126
}

0 commit comments

Comments
 (0)