[CONTROLLER][Attachment] Some attachments may not have dimensions

This commit is contained in:
Diogo Peralta Cordeiro 2021-08-18 22:12:27 +01:00 committed by Hugo Sales
parent 450dbfb98f
commit 2a3db65216
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -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);