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.
This commit is contained in:
parent
fde6558a6f
commit
7cf79171a8
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user