[boobmsg] Use url suffix to save photos with their extension
This commit is contained in:
parent
c79b8622e8
commit
b0f1035ae8
1 changed files with 5 additions and 1 deletions
|
|
@ -455,7 +455,11 @@ class Boobmsg(ReplApplication):
|
|||
# Write photo to temporary files
|
||||
tmp_files = []
|
||||
for photo in contact.photos.values():
|
||||
f = NamedTemporaryFile(suffix='.jpg')
|
||||
suffix = '.jpg'
|
||||
if '.' in photo.url.split('/')[-1]:
|
||||
suffix = '.%s' % photo.url.split('/')[-1].split('.')[-1]
|
||||
f = NamedTemporaryFile(suffix=suffix)
|
||||
|
||||
photo = backend.fillobj(photo, 'data')
|
||||
f.write(photo.data)
|
||||
tmp_files.append(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue