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)
This commit is contained in:
Kevin Hu 2025-01-13 17:34:50 +08:00 committed by GitHub
parent d8346cb7a6
commit c08382099a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: