wger: no-gifs patch + guinicorn

This commit is contained in:
eyjhb 2024-12-05 19:30:01 +01:00
parent 6c33d36fc5
commit ff3ea0735c
Signed by: eyjhb
GPG key ID: 609F508E3239F920
3 changed files with 45 additions and 4 deletions

View file

@ -8,7 +8,7 @@
let
frontend = callPackage ./frontend.nix {};
in python3.pkgs.buildPythonApplication rec {
in python3.pkgs.buildPythonPackage rec {
pname = "wger";
version = "unstable-2024-12-01";
pyproject = true;
@ -28,6 +28,7 @@ in python3.pkgs.buildPythonApplication rec {
./patches/pyproject.patch
./patches/tasks.patch
./patches/manage.patch
./patches/exercises-no-gifs.patch
];
# dependencies = with python3.pkgs; [

View file

@ -0,0 +1,32 @@
diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py
index d6387bb2b..86bca386b 100644
--- a/wger/exercises/api/views.py
+++ b/wger/exercises/api/views.py
@@ -374,12 +374,13 @@ def search(request):
image = image_obj.image.url
t = get_thumbnailer(image_obj.image)
thumbnail = None
- try:
- thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url
- except InvalidImageFormatError as e:
- logger.info(f'InvalidImageFormatError while processing a thumbnail: {e}')
- except OSError as e:
- logger.info(f'OSError while processing a thumbnail: {e}')
+ if not image.lower().endswith(".gif"):
+ try:
+ thumbnail = t.get_thumbnail(aliases.get('micro_cropped')).url
+ except InvalidImageFormatError as e:
+ logger.info(f'InvalidImageFormatError while processing a thumbnail: {e}')
+ except OSError as e:
+ logger.info(f'OSError while processing a thumbnail: {e}')
result_json = {
'value': translation.name,
@@ -393,6 +394,7 @@ def search(request):
},
}
results.append(result_json)
+
response['suggestions'] = results
return Response(response)