From 45c8f71af065b2ee7ab4752a882b4ececd1b6340 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 10 Mar 2025 16:14:33 +0100 Subject: [PATCH] Resolve #1883 --- .../app/libraries/snappymail/file/mimetype.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/file/mimetype.php b/snappymail/v/0.0.0/app/libraries/snappymail/file/mimetype.php index 6156145da..7fc04b9af 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/file/mimetype.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/file/mimetype.php @@ -43,15 +43,18 @@ abstract class MimeType \fclose($fp); } if ('application/zip' === \str_replace('/x-', '/', $mime)) { - $zip = new \ZipArchive(); - if ($zip->open($filename, \ZIPARCHIVE::RDONLY)) { - if (false !== $zip->locateName('word/_rels/document.xml.rels')) { - return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; - } - if (false !== $zip->locateName('xl/_rels/workbook.xml.rels')) { - return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + if (\class_exists('ZipArchive')) { + $zip = new \ZipArchive(); + if ($zip->open($filename, \ZIPARCHIVE::RDONLY)) { + if (false !== $zip->locateName('word/_rels/document.xml.rels')) { + return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; + } + if (false !== $zip->locateName('xl/_rels/workbook.xml.rels')) { + return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + } } } + $mime = \str_replace('/x-', '/', $mime); } } return $mime ? static::detectDeeper($mime, $name ?: $filename) : null;