From 5454bb5b07b740fd9417af66191dc3dd8356f1b4 Mon Sep 17 00:00:00 2001 From: Frank Fenor Date: Mon, 11 Mar 2024 19:16:01 +0100 Subject: [PATCH] Avoid throwing an exception if Content-Disposition header doesn't exist or contains illegal things --- src/Services/Attachments/AttachmentSubmitHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index e7fb2ceb..1ca02a96 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -370,8 +370,8 @@ class AttachmentSubmitHandler //If a content disposition header was set try to extract the filename out of it if (isset($headers['content-disposition'])) { $tmp = []; - preg_match('/[^;\\n=]*=([\'\"])*(.*)(?(1)\1|)/', $headers['content-disposition'][0], $tmp); - $filename = $tmp[2]; + if (preg_match('/[^;\\n=]*=([\'\"])*(.*)(?(1)\1|)/', $headers['content-disposition'][0], $tmp)) + $filename = $tmp[2]; } //If we don't know filename yet, try to determine it out of url