From c6710052d2a4d9514e78f6b480108225f14224bb Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 16 Nov 2018 12:08:11 +0100 Subject: [PATCH] Fix regression introduced by commit c3ed5fb0 (issue #18 - fixes issue #20 --- ivatar/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ivatar/views.py b/ivatar/views.py index 32d55fb..5c2b1c7 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -127,7 +127,12 @@ class AvatarImageView(TemplateView): if str(default) == 'mm' or str(default) == 'mp': # If mm is explicitly given, we need to catch that - pass + static_img = path.join('static', 'img', 'mm', '%s%s' % (str(size), '.png')) + if not path.isfile(static_img): + # We trust this exists!!! + static_img = path.join('static', 'img', 'mm', '512.png') + # We trust static/ is mapped to /static/ + return HttpResponseRedirect('/' + static_img) else: return HttpResponseRedirect(default)