Avoid throwing an exception if Content-Disposition header doesn't exist or contains illegal things

This commit is contained in:
Frank Fenor 2024-03-11 19:16:01 +01:00
parent 04d5cd741b
commit 5454bb5b07
No known key found for this signature in database
GPG key ID: E6B5029FCCE96376

View file

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