From abeae64d1bbaa3ae7911a1f0669ecf7a8b11e7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=81=A5=E8=BE=89?= <40563566+WangJianhui666@users.noreply.github.com> Date: Mon, 25 Feb 2019 20:47:22 +0800 Subject: [PATCH] [markdown lint]add try to check slate data (#2997) --- seahub/api2/endpoints/markdown_lint.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/seahub/api2/endpoints/markdown_lint.py b/seahub/api2/endpoints/markdown_lint.py index c8b2ed10ae..54094f7138 100644 --- a/seahub/api2/endpoints/markdown_lint.py +++ b/seahub/api2/endpoints/markdown_lint.py @@ -31,7 +31,12 @@ class MarkdownLintView(APIView): if not slate: error_msg = 'slate invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) - slate = json.loads(slate) + try: + slate = json.loads(slate) + except Exception as e: + logger.error(e) + error_msg = 'slate invalid.' + return api_error(status.HTTP_400_BAD_REQUEST, error_msg) issue_list = [] document_nodes = slate["document"]["nodes"]