From f899c7b4285f2314d7c97c3d29b5119efbd7a415 Mon Sep 17 00:00:00 2001 From: Antony Chazapis Date: Wed, 7 Sep 2011 16:37:29 +0300 Subject: [PATCH 1/1] Fix PUT object via hashmap. --- pithos/api/functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pithos/api/functions.py b/pithos/api/functions.py index 89c8d0b..fc29914 100644 --- a/pithos/api/functions.py +++ b/pithos/api/functions.py @@ -721,20 +721,20 @@ def object_write(request, v_account, v_container, v_object): raise BadRequest('Invalid data formating') try: hashmap = d['hashes'] - size = d['bytes'] - except KeyError: + size = int(d['bytes']) + except: raise BadRequest('Invalid data formatting') elif request.serialization == 'xml': try: xml = minidom.parseString(data) obj = xml.getElementsByTagName('object')[0] - size = obj.attributes['bytes'].value + size = int(obj.attributes['bytes'].value) hashes = xml.getElementsByTagName('hash') hashmap = [] for hash in hashes: hashmap.append(hash.firstChild.data) - except Exception: + except: raise BadRequest('Invalid data formatting') meta.update({'hash': hashmap_hash(hashmap)}) # Update ETag. -- 1.7.10.4