Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/chat/serializers/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,9 @@ def get_chat_record(chat_info, chat_record_id):
return chat_record_list[-1]
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
if chat_record is None:
if not is_valid_uuid(chat_record_id):
raise ChatException(500, _("Conversation record does not exist"))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要校验id的格式,理论上记录不存在就应该直接抛出异常。和ID的格式无关才对。

raise ChatException(500, _("Conversation record does not exist"))
else:
return chat_record
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id).first()
return chat_record

Expand Down
Loading