From c08382099a6e87e70583c0b50b1f7f78de3e041a Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Mon, 13 Jan 2025 17:34:50 +0800 Subject: [PATCH] Check meta data format in json map (#4461) ### What problem does this PR solve? #3690 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- api/apps/document_app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 81bf1ec3c04..21aff7dd6ad 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -612,6 +612,10 @@ def set_meta(): except Exception as e: return get_json_result( data=False, message=f'Json syntax error: {e}', code=settings.RetCode.ARGUMENT_ERROR) + if not isinstance(meta, dict): + return get_json_result( + data=False, message='Meta data should be in Json map format, like {"key": "value"}', code=settings.RetCode.ARGUMENT_ERROR) + try: e, doc = DocumentService.get_by_id(req["doc_id"]) if not e: