Allow files with upper case extensions when uploading avatar

Discovered when attempting to upload a file with name avatar.JPG

The following error was reported in the logs:
```
File "/app/funkwhale_api/common/serializers.py", line 213, in to_internal_value
     format=PIL.Image.EXTENSION[os.path.splitext(file_obj.name)[-1]],
 KeyError: '.JPG'
```
merge-requests/1042/head
techknowlogick 2020-02-02 09:11:35 +01:00 zatwierdzone przez Eliot Berriot
rodzic e9553a01ce
commit 7d6f6e8515
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -219,7 +219,7 @@ class StripExifImageField(serializers.ImageField):
with io.BytesIO() as output:
image_without_exif.save(
output,
format=PIL.Image.EXTENSION[os.path.splitext(file_obj.name)[-1]],
format=PIL.Image.EXTENSION[os.path.splitext(file_obj.name)[-1].lower()],
quality=100,
)
content = output.getvalue()