Skip to content

Commit

Permalink
Compressed the check for pdf type
Browse files Browse the repository at this point in the history
  • Loading branch information
LuomaJuha committed Aug 28, 2023
1 parent b99c11d commit 99b65a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions module/Finna/src/Finna/RecordDriver/SolrQdc.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,12 @@ public function getAllImages($language = 'fi', $includePdf = true)
if ((string)$attributes->bundle !== 'ORIGINAL') {
continue;
}
$mediaTypes = ['application/pdf'];
$url = isset($attributes->href)
? (string)$attributes->href : (string)$node;
$type = trim((string)$attributes->type);
if (
($type && !in_array($attributes->type, $mediaTypes))
|| (!$type && !preg_match('/\.(pdf)$/i', $url))
($type && $type !== 'application/pdf')
|| (!$type && !preg_match('/\.pdf$/i', $url))
) {
continue;
}
Expand Down

0 comments on commit 99b65a6

Please sign in to comment.