diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-28 09:41:42 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-05-28 09:42:44 -0700 |
commit | ae595795f09edbe0883d233a7a8483f6445b9ed7 (patch) | |
tree | 8f2fa2dc0c717ad21ac4b782ab50f5553368ca82 /modules/gallery/helpers/item_rest.php | |
parent | 56587febfff2955c09b5b82a63c31cf547066f32 (diff) |
If the file is empty (i.e. the upload failed, then throw a 'bad request' exception before trying to create the item.
Diffstat (limited to 'modules/gallery/helpers/item_rest.php')
-rw-r--r-- | modules/gallery/helpers/item_rest.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 298c2f4a..ec86ce93 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -160,6 +160,9 @@ class item_rest_Core { 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); |