refactor: improve error message for non-existent files in document handling
--bug=1057925 --user=刘瑞斌 【知识库】知识库快速创建空白文档-添加段落和内容-随后下载源文档-下载文件提示异常 https://www.tapd.cn/62980211/s/1723202
This commit is contained in:
parent
cb28cfd427
commit
9c7eb22c61
@ -563,7 +563,7 @@ class DocumentSerializers(serializers.Serializer):
|
|||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
file = QuerySet(File).filter(source_id=self.data.get('document_id')).first()
|
file = QuerySet(File).filter(source_id=self.data.get('document_id')).first()
|
||||||
if not file:
|
if not file:
|
||||||
raise AppApiException(500, _('file not exist'))
|
raise AppApiException(500, _('File not exist. Only manually uploaded documents are supported.'))
|
||||||
return FileSerializer.Operate(data={'id': file.id}).get(with_valid=True)
|
return FileSerializer.Operate(data={'id': file.id}).get(with_valid=True)
|
||||||
|
|
||||||
def one(self, with_valid=False):
|
def one(self, with_valid=False):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user