From 2a3db652163689a05584b0ec0e3b38ab17be4e64 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Wed, 18 Aug 2021 22:12:27 +0100 Subject: [PATCH] [CONTROLLER][Attachment] Some attachments may not have dimensions --- src/Controller/Attachment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controller/Attachment.php b/src/Controller/Attachment.php index 3a87cfa437..948daa606a 100644 --- a/src/Controller/Attachment.php +++ b/src/Controller/Attachment.php @@ -147,7 +147,9 @@ class Attachment extends Controller throw new ClientException(_m('The requested thumbnail dimensions are not allowed'), 400); // 400 Bad Request } - [$width, $height] = AttachmentThumbnail::predictScalingValues($attachment->getWidth(), $attachment->getHeight(), $width, $height, $crop); + if (!is_null($attachment->getWidth()) && !is_null($attachment->getHeight())) { + [$width, $height] = AttachmentThumbnail::predictScalingValues($attachment->getWidth(), $attachment->getHeight(), $width, $height, $crop); + } $thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);