Skip to content

Commit

Permalink
Fix padding, larger avatar size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
stiletto committed Jan 26, 2014
1 parent 3163e9a commit e05612d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bnw/xmpp/iq_handlers.py
Expand Up @@ -46,11 +46,14 @@ def get_and_resize_avatar(iq):
if not filedata:
return
filedata = str(filedata)
if len(filedata) > 32768:
if len(filedata) > 102400:
# XEP-0153 says what image SHOULD be 8KB max,
# let's approve up to 32KB.
# let's approve up to 100KB.
return
try:
missing_padding = 4 - len(filedata) % 4
if missing_padding:
filedata += '=' * missing_padding
avatar = base64.b64decode(filedata)
except TypeError:
return
Expand Down

0 comments on commit e05612d

Please sign in to comment.