From 082969de721a5bc6db977d2d7e1d766eda03ae4f Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Thu, 20 Dec 2018 15:26:14 +0700 Subject: [PATCH] Fix #427. JSON parse error on history detail --- app/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views.py b/app/views.py index b6e44a1..00cb974 100644 --- a/app/views.py +++ b/app/views.py @@ -829,7 +829,8 @@ def record_apply(domain_name): r = Record() result = r.apply(domain_name, submitted_record) if result['status'] == 'ok': - history = History(msg='Apply record changes to domain {0}'.format(domain_name), detail=str(jdata), created_by=current_user.username) + jdata.pop('_csrf_token', None) # don't store csrf token in the history. + history = History(msg='Apply record changes to domain {0}'.format(domain_name), detail=str(json.dumps(jdata)), created_by=current_user.username) history.add() return make_response(jsonify( result ), 200) else: @@ -1095,7 +1096,8 @@ def apply_records(template): t = DomainTemplate.query.filter(DomainTemplate.name == template).first() result = t.replace_records(records) if result['status'] == 'ok': - history = History(msg='Apply domain template record changes to domain template {0}'.format(template), detail=str(jdata), created_by=current_user.username) + jdata.pop('_csrf_token', None) # don't store csrf token in the history. + history = History(msg='Apply domain template record changes to domain template {0}'.format(template), detail=str(json.dumps(jdata)), created_by=current_user.username) history.add() return make_response(jsonify(result), 200) else: