From ae595795f09edbe0883d233a7a8483f6445b9ed7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 28 May 2010 09:41:42 -0700 Subject: If the file is empty (i.e. the upload failed, then throw a 'bad request' exception before trying to create the item. --- modules/gallery/helpers/item_rest.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules') 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); -- cgit v1.2.3