Skip to content

Commit

Permalink
If the file is empty (i.e. the upload failed, then throw a 'bad reque…
Browse files Browse the repository at this point in the history
…st' exception before trying to create the item.
  • Loading branch information
Tim Almdal committed May 28, 2010
1 parent 56587fe commit ae59579
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/gallery/helpers/item_rest.php
Expand Up @@ -160,6 +160,9 @@ static function post($request) {

case "photo":
case "movie":
if (empty($request->file)) {
throw new Rest_Exception("Bad Request: Upload failed", 400);
}
$item->type = $entity->type;
$item->parent_id = $parent->id;
$item->set_data_file($request->file);
Expand Down

0 comments on commit ae59579

Please sign in to comment.