Simplify code
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 31 Jan 2019 14:23:29 +0000 (15:23 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Thu, 31 Jan 2019 14:23:29 +0000 (15:23 +0100)
See #2825

wcfsetup/install/files/lib/action/AJAXFileUploadAction.class.php

index 44f5e7080ca965892811d1a2c835f3dac6e308d9..98a4070d02bf44fc6636fde2bd81c58c33f75be1 100644 (file)
@@ -89,10 +89,10 @@ class AJAXFileUploadAction extends AbstractSecureAction {
                foreach ($_FILES['__files']['tmp_name'] as $id => $tmpName) {
                        if ($field->isImageOnly()) {
                                if (@getimagesize($tmpName) === false) {
-                                       if (!($field->svgImagesAllowed() && in_array(FileUtil::getMimeType($tmpName), [
+                                       if (!$field->svgImagesAllowed() || !in_array(FileUtil::getMimeType($tmpName), [
                                                        'image/svg',
                                                        'image/svg+xml'
-                                               ]))) {
+                                               ])) {
                                                $response['error'][$i++] = [
                                                        'filename' => $_FILES['__files']['name'][$id],
                                                        'errorMessage' => WCF::getLanguage()->get('wcf.upload.error.noImage')