From 7d6f6e851550722f62a856cd91bbb0adb72f062a Mon Sep 17 00:00:00 2001
From: techknowlogick <matti@mdranta.net>
Date: Sun, 2 Feb 2020 09:11:35 +0100
Subject: [PATCH] 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'
```
---
 api/funkwhale_api/common/serializers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/funkwhale_api/common/serializers.py b/api/funkwhale_api/common/serializers.py
index c754540c9..f1f332d13 100644
--- a/api/funkwhale_api/common/serializers.py
+++ b/api/funkwhale_api/common/serializers.py
@@ -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()
-- 
GitLab