Harmlessly ignore bad params to Libravatar

I was throwing 400s when bad parameters are provided, but the spec
actually says you're supposed to just ignore them entirely.
This commit is contained in:
Danielle McLean 2021-08-22 23:08:45 +10:00
parent 7fcc3c8788
commit 76496e7169
Signed by: 00dani
GPG key ID: 9DDE1EDE01E3A605

View file

@ -21,9 +21,9 @@ def libravatar(request, hash):
try:
size = int(size)
except ValueError:
return utils.bad_req('size parameter must be an integer')
size = 80
if not 1 <= size <= 512:
return utils.bad_req('size parameter must be between 1 and 512')
size = 512
if len(hash) == 32:
where = Q(email_md5=hash)