fix: update error message for non-existent files in document handling

This commit is contained in:
CaptainB 2025-07-15 12:20:09 +08:00
parent 55985a2460
commit 05409b8f90
4 changed files with 12 additions and 3 deletions

View File

@ -602,7 +602,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. Only manually uploaded documents are supported.')) 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):

View File

@ -8503,3 +8503,5 @@ msgstr ""
msgid "Modify application access token" msgid "Modify application access token"
msgstr "" msgstr ""
msgid "File not exist. Only manually uploaded documents are supported"
msgstr ""

View File

@ -8628,3 +8628,6 @@ msgstr "生成相关文档"
msgid "Modify application access token" msgid "Modify application access token"
msgstr "修改应用程序访问令牌" msgstr "修改应用程序访问令牌"
msgid "File not exist. Only manually uploaded documents are supported"
msgstr "文件不存在, 仅支持手动上传的文档"

View File

@ -8628,3 +8628,7 @@ msgstr "生成相關文檔"
msgid "Modify application access token" msgid "Modify application access token"
msgstr "修改應用程序訪問權杖" msgstr "修改應用程序訪問權杖"
msgid "File not exist. Only manually uploaded documents are supported"
msgstr "文件不存在, 僅支持手動上傳的文檔"