Skip to content

Commit d370f97

Browse files
committed
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
1 parent 8b417d6 commit d370f97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Services/Attachments/AttachmentURLGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ public function getInternalViewURL(Attachment $attachment): ?string
112112
/**
113113
* Returns a URL to a thumbnail of the attachment file.
114114
* For external files the original URL is returned.
115-
* @return string|null The URL or null if the attachment file is not existing
115+
* @return string|null The URL or null if the attachment file is not existing or is invalid
116116
*/
117117
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string
118118
{
119119
if (!$attachment->isPicture()) {
120-
throw new InvalidArgumentException('Thumbnail creation only works for picture attachments!');
120+
return null;
121121
}
122122

123123
if (!$attachment->hasInternal()){

0 commit comments

Comments
 (0)