diff --git a/core/extension.class.php b/core/extension.class.php index a1175341..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,6 +197,9 @@ abstract class DataHandlerExtension extends Extension { } } } + elseif($supported_ext && !$check_contents){ + throw new UploadException("Invalid or corrupted file"); + } } public function onThumbnailGeneration(ThumbnailGenerationEvent $event) {