From d370f976a7b0c19d502aadbaa0f93eb90c2a6ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 12 Aug 2025 23:29:24 +0200 Subject: [PATCH] Return null instead of throwing an exception that could lead to a denial of service when trying to generate a thumbnail for a non-image picture --- src/Services/Attachments/AttachmentURLGenerator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index c22cefe4..e505408f 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -112,12 +112,12 @@ class AttachmentURLGenerator /** * Returns a URL to a thumbnail of the attachment file. * For external files the original URL is returned. - * @return string|null The URL or null if the attachment file is not existing + * @return string|null The URL or null if the attachment file is not existing or is invalid */ public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string { if (!$attachment->isPicture()) { - throw new InvalidArgumentException('Thumbnail creation only works for picture attachments!'); + return null; } if (!$attachment->hasInternal()){