Fixed exception, when downloading an attachment file, which does not have a usable extension

This commit is contained in:
Jan Böhmer 2023-11-27 18:13:55 +01:00
parent da0845c11c
commit 05e9b63f89

View file

@ -357,7 +357,7 @@ class AttachmentSubmitHandler
//Check if we have an extension given //Check if we have an extension given
$pathinfo = pathinfo($filename); $pathinfo = pathinfo($filename);
if ($pathinfo['extension'] !== '') { if (isset($pathinfo['extension']) && $pathinfo['extension'] !== '') {
$new_ext = $pathinfo['extension']; $new_ext = $pathinfo['extension'];
} else { //Otherwise we have to guess the extension for the new file, based on its content } else { //Otherwise we have to guess the extension for the new file, based on its content
$new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp'; $new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp';