From 7506326cd71bbe641622ad6240d88ac4e8dd3aa0 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sat, 8 Apr 2017 11:28:08 +0200 Subject: [PATCH] decode the utf8 encoded body to a unicode string before passing it on --- src/shop/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shop/views.py b/src/shop/views.py index d80b6772..0d0e59ae 100644 --- a/src/shop/views.py +++ b/src/shop/views.py @@ -603,7 +603,7 @@ class CoinifyCallbackView(SingleObjectMixin, View): # attempt to parse json try: - parsed = json.loads(request.body) + parsed = json.loads(request.body.decode('utf-8')) except Exception as E: parsed = '' @@ -622,7 +622,7 @@ class CoinifyCallbackView(SingleObjectMixin, View): return HttpResponseBadRequest('unable to parse json') # attemt to validate the callbackc - if sdk.validate_callback(request.body, signature): + if sdk.validate_callback(request.body.decode('utf-8'), signature): # mark callback as valid in db callbackobject.valid=True callbackobject.save()