Skip to content

Commit

Permalink
Only proxy images through cover proxy. (#3379)
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Feb 5, 2024
1 parent 40ae884 commit f9ab536
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions module/VuFind/src/VuFind/Controller/CoverController.php
Expand Up @@ -129,10 +129,13 @@ public function showAction()
if (!empty($url)) {
try {
$image = $this->proxy->fetch($url);
return $this->displayImage(
$image->getHeaders()->get('content-type')->getFieldValue(),
$image->getContent()
);
$contentType = $image?->getHeaders()?->get('content-type')?->getFieldValue() ?? '';
if (str_starts_with(strtolower($contentType), 'image/')) {
return $this->displayImage(
$contentType,
$image->getContent()
);
}
} catch (\Exception $e) {
// If an exception occurs, drop through to the standard case
// to display an image unavailable graphic.
Expand Down

0 comments on commit f9ab536

Please sign in to comment.