Bug #3745
PUT raises 500 error in case of misformated json request body
Status: | Resolved | Start date: | 05/16/2013 | |
---|---|---|---|---|
Priority: | Medium | Due date: | ||
Assignee: | Sofia Papagiannaki | % Done: | 0% |
|
Category: | Pithos | Spent time: | - | |
Target version: | - |
Description
a PUT request at object level with a json formated hashmap returns an INTERNAL SERVER ERROR (500) if the request body is not a well formed json string
Associated revisions
Pithos: Catch invalid hashmap input
Refs: #3745
History
#1 Updated by Sofia Papagiannaki over 10 years ago
The traceback produced:
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/pithos/api/util.py", line 1121, in wrapper
response = func(request, *args, **kwargs)
File "/usr/lib/python2.6/dist-packages/pithos/api/functions.py", line 1065, in object_write
hashmap, checksum, 'pithos', meta, True, permissions)
File "/usr/lib/python2.6/dist-packages/pithos/backends/modular.py", line 122, in fn
ret = func(self, *args, **kw)
File "/usr/lib/python2.6/dist-packages/pithos/backends/modular.py", line 918, in update_object_hashmap
map.extend([binascii.unhexlify(x) for x in hashmap])
TypeError: Odd-length string
#2 Updated by Stavros Sachtouris over 10 years ago
To reproduce the error, try a body like this:
{'hashes': ['e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'], 'bytes': 2048}
#3 Updated by Sofia Papagiannaki about 10 years ago
- Status changed from New to Resolved
To reproduce the error use the following body (the above does not produces this problem):
{'hashes': ['e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 '], 'bytes': 2048}