Commit 1800feec authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

cyclades: Catch exception in verify_personality

The verify_personality function assumes that the contents of a
personality is encoded in base64 and tries to decode them. But if the
client didn't encode them a TypeError `Incorrect padding' will be
raised. Catch this exception and raise a BadRequest.
parent 3ce3f698
......@@ -351,7 +351,7 @@ def verify_personality(personality):
raise faults.OverLimit("Maximum size of personality exceeded")
if len(b64decode(contents)) > settings.MAX_PERSONALITY_SIZE:
raise faults.OverLimit("Maximum size of personality exceeded")
except AssertionError:
except (AssertionError, TypeError):
raise faults.BadRequest("Malformed personality in request")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment