summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-05-28 09:41:42 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-05-28 09:42:44 -0700
commitae595795f09edbe0883d233a7a8483f6445b9ed7 (patch)
tree8f2fa2dc0c717ad21ac4b782ab50f5553368ca82 /modules
parent56587febfff2955c09b5b82a63c31cf547066f32 (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')
-rw-r--r--modules/gallery/helpers/item_rest.php3
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);