Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions module/DigLib/src/DigLib/Controller/VuDLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,16 +846,16 @@ public function passthroughAction()
protected function getIdsFromManifest($data)
{
$ids = [];
if (isset($data['sequences'][0]['canvases'])) {
foreach ($data['sequences'][0]['canvases'] as $canvas) {
preg_match(
'/vudl:[0-9]+/',
$canvas['rendering'][0]['@id'] ?? '',
$matches
);
if (isset($matches[0])) {
$ids[] = $matches[0];
}

foreach ($data['items'] as $canvas) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding this little safety check so if 'items' is somehow undefined, the system doesn't error out.

Suggested change
foreach ($data['items'] as $canvas) {
foreach ($data['items'] ?? [] as $canvas) {

preg_match(
'/vudl:[0-9]+/',
$canvas['rendering'][0]['id'] ?? '',
$matches
);

if (isset($matches[0])) {
$ids[] = $matches[0];
}
}
return $ids;
Expand Down
Loading