Skip to content

Commit

Permalink
Fix IIIF plugin missing last page + erroring when metadata unspecified (
Browse files Browse the repository at this point in the history
#1349)

Co-authored-by: Drini Cami <cdrini@gmail.com>
  • Loading branch information
glorieux-f and cdrini authored Oct 15, 2024
1 parent a9c279c commit cb9fd0b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/plugins/plugin.iiif.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IIIFPlugin {
bookTitle: resolveInternationalString(manifest.label),
pageProgression: manifest.viewingDirection == "right-to-left" ? "rl" : "lr",
// numLeafs: manifest.items.length,
metadata: manifest.metadata.map((metadata) => {
metadata: (manifest.metadata || []).map((metadata) => {
return {
label: resolveInternationalString(metadata.label),
value: resolveInternationalString(metadata.value),
Expand Down Expand Up @@ -76,7 +76,9 @@ class IIIFPlugin {
spread = [];
}
});

if (spread.length > 0) {
book.data.push(spread);
}
return book;
}

Expand Down Expand Up @@ -116,7 +118,9 @@ class IIIFPlugin {
spread = [];
}
});

if (spread.length > 0) {
book.data.push(spread);
}
return book;
}
}
Expand Down

0 comments on commit cb9fd0b

Please sign in to comment.