Skip to content

Commit

Permalink
fix for shift-org#483, when validation fails don't try to move the file.
Browse files Browse the repository at this point in the history
( which stops the exception from throwing, and properly returns an 4xx error with error json as expected. )
  • Loading branch information
ionous committed Apr 26, 2023
1 parent 5931825 commit ecdd90d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/www/manage_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ function upload_attached_file($event, $messages) {
$file_message = $uploader->validate('file', TRUE);
if ($file_message != null) {
$messages = array('file' => $file_message);
} else {
global $IMAGEDIR;
$file = $uploader->move($IMAGEDIR, 'file');
$event->setImage($file->getName());
}
global $IMAGEDIR;
$file = $uploader->move($IMAGEDIR, 'file');
$event->setImage($file->getName());
}
return $messages;
}
Expand Down

0 comments on commit ecdd90d

Please sign in to comment.