Changed upload to detect unrecognized files so that it doesn't just blankly refresh when the type isn't handled
This commit is contained in:
parent
58acb71282
commit
8950d27d64
@ -27,7 +27,6 @@ class DataUploadEvent extends Event
|
||||
public $merged = false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Some data is being uploaded.
|
||||
* This should be caught by a file handler.
|
||||
@ -348,6 +347,9 @@ class Upload extends Extension
|
||||
|
||||
$event = new DataUploadEvent($file['tmp_name'], $metadata);
|
||||
send_event($event);
|
||||
if ($event->image_id == -1) {
|
||||
throw new UploadException("File type not supported: " . $metadata['extension']);
|
||||
}
|
||||
$page->add_http_header("X-Shimmie-Image-ID: " . int_escape($event->image_id));
|
||||
} catch (UploadException $ex) {
|
||||
$this->theme->display_upload_error(
|
||||
@ -441,6 +443,9 @@ class Upload extends Extension
|
||||
try {
|
||||
$event = new DataUploadEvent($tmp_filename, $metadata);
|
||||
send_event($event);
|
||||
if ($event->image_id == -1) {
|
||||
throw new UploadException("File type not supported: " . $metadata['extension']);
|
||||
}
|
||||
} catch (UploadException $ex) {
|
||||
$this->theme->display_upload_error(
|
||||
$page,
|
||||
|
Loading…
x
Reference in New Issue
Block a user