From eb30fb6e8361011b99395e758e3b68ffcd26ba29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 27 Nov 2023 18:27:36 +0100 Subject: [PATCH] Fixed thumbnail for SVG files where the original name had no svg extension --- src/Services/Attachments/AttachmentURLGenerator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index afbfade3..d28a8d65 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -135,7 +135,10 @@ class AttachmentURLGenerator } //GD can not work with SVG, so serve it directly... - if ('svg' === $attachment->getExtension()) { + //We can not use getExtension here, because it uses the original filename and not the real extension + //Instead we use the logic, which is also used to determine if the attachment is a picture + $extension = pathinfo(parse_url($attachment->getPath(), PHP_URL_PATH) ?? '', PATHINFO_EXTENSION); + if ('svg' === $extension) { return $this->assets->getUrl($asset_path); }