From 7cf79171a8a3b232044e75f0bc3955c29676b358 Mon Sep 17 00:00:00 2001 From: HungryFeline Date: Wed, 1 Jan 2014 18:25:28 +0100 Subject: [PATCH] Update extension.class.php Fix my previous commit. Also put the results of the tests into variables so we don't need to check them again. --- core/extension.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/extension.class.php b/core/extension.class.php index 0b4c767b..3407ba10 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -142,7 +142,7 @@ abstract class DataHandlerExtension extends Extension { public function onDataUpload(DataUploadEvent $event) { global $user; - if($this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($supported_ext = $this->supported_ext($event->type)) && ($check_contents = $this->check_contents($event->tmpname))) { if(!move_upload_to_archive($event)) return; send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); @@ -197,8 +197,8 @@ abstract class DataHandlerExtension extends Extension { } } } - else{ - throw new UploadException("Unsupported extension or file isn't an image"); + elseif($supported_ext && !$check_contents){ + throw new UploadException("Invalid or corrupted file"); } }