Fix file name could be lost when uploading files

Leading to invalid extension when sending photos.
This commit is contained in:
Lonami Exo
2023-10-17 20:31:58 +02:00
parent eb67ef1b15
commit fda6840449
3 changed files with 10 additions and 10 deletions

View File

@@ -90,6 +90,7 @@ def _resize_photo_if_needed(
buffer = io.BytesIO()
result.save(buffer, 'JPEG', progressive=True, **kwargs)
buffer.seek(0)
buffer.name = getattr(file, 'name', None)
return buffer
except IOError:
return file