Skip to content

Commit 9efd131

Browse files
committed
[BUGFIX] check for undefined array key for fileGrp in mets:fileSec
1 parent 4b3a130 commit 9efd131

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Classes/Controller/ToolboxController.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,18 @@ private function renderImageDownloadTool(): void
321321
private function getFile(int $page, array $fileGrps): array
322322
{
323323
$file = [];
324+
$physicalStructureInfo = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$page]] ?? null;
324325
while ($fileGrp = @array_pop($fileGrps)) {
325-
$physicalStructureInfo = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$page]];
326-
$fileId = $physicalStructureInfo['files'][$fileGrp];
327-
if (!empty($fileId)) {
328-
$file['url'] = $this->currentDocument->getDownloadLocation($fileId);
329-
$file['mimetype'] = $this->currentDocument->getFileMimeType($fileId);
326+
if (isset($physicalStructureInfo['files'][$fileGrp])) {
327+
$fileId = $physicalStructureInfo['files'][$fileGrp];
328+
if (!empty($fileId)) {
329+
$file['url'] = $this->currentDocument->getDownloadLocation($fileId);
330+
$file['mimetype'] = $this->currentDocument->getFileMimeType($fileId);
331+
} else {
332+
$this->logger->warning('File not found in fileGrp "' . $fileGrp . '"');
333+
}
330334
} else {
331-
$this->logger->warning('File not found in fileGrp "' . $fileGrp . '"');
335+
$this->logger->warning('fileGrp "' . $fileGrp . '" not found in Document mets:fileSec');
332336
}
333337
}
334338
return $file;

0 commit comments

Comments
 (0)