feat(message): enhance HTML asset normalization with error handling and validation

This commit is contained in:
mlogclub
2026-04-17 13:34:36 +08:00
parent 0dfa783eec
commit f4761d768c
3 changed files with 95 additions and 29 deletions
+4 -1
View File
@@ -457,7 +457,10 @@ func (s *messageService) normalizeMessageContent(conversationID int64, messageTy
switch messageType {
case enums.IMMessageTypeHTML:
sanitized := utils.SanitizeMessageHTML(content)
normalized := utils.NormalizeMessageHTMLAssets(sanitized)
normalized, err := utils.NormalizeMessageHTMLAssets(sanitized)
if err != nil {
return "", "", "", errorsx.InvalidParam("HTML消息中的图片必须使用已上传文件")
}
summary := utils.BuildHTMLSummary(normalized)
if summary == "" {
return "", "", "", errorsx.InvalidParam("消息内容不能为空")