Kevin Hu
commited on
Commit
·
d2bd1d1
1
Parent(s):
26d72b4
Check meta data format in json map (#4461)
Browse files### 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 -0
api/apps/document_app.py
CHANGED
|
@@ -612,6 +612,10 @@ def set_meta():
|
|
| 612 |
except Exception as e:
|
| 613 |
return get_json_result(
|
| 614 |
data=False, message=f'Json syntax error: {e}', code=settings.RetCode.ARGUMENT_ERROR)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
try:
|
| 616 |
e, doc = DocumentService.get_by_id(req["doc_id"])
|
| 617 |
if not e:
|
|
|
|
| 612 |
except Exception as e:
|
| 613 |
return get_json_result(
|
| 614 |
data=False, message=f'Json syntax error: {e}', code=settings.RetCode.ARGUMENT_ERROR)
|
| 615 |
+
if not isinstance(meta, dict):
|
| 616 |
+
return get_json_result(
|
| 617 |
+
data=False, message='Meta data should be in Json map format, like {"key": "value"}', code=settings.RetCode.ARGUMENT_ERROR)
|
| 618 |
+
|
| 619 |
try:
|
| 620 |
e, doc = DocumentService.get_by_id(req["doc_id"])
|
| 621 |
if not e:
|