diff --git a/internal/service/comment.go b/internal/service/comment.go index 0d745eb8..7a70dd51 100644 --- a/internal/service/comment.go +++ b/internal/service/comment.go @@ -1,7 +1,6 @@ package service import ( - "strings" "time" "github.com/gin-gonic/gin" @@ -116,7 +115,7 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) for _, item := range param.Contents { // 检查附件是否是本站资源 if item.Type == model.CONTENT_TYPE_IMAGE || item.Type == model.CONTENT_TYPE_VIDEO || item.Type == model.CONTENT_TYPE_ATTACHMENT { - if strings.Index(item.Content, "https://"+global.AliOSSSetting.Domain) != 0 { + if err := attachmentChecker.Check(item.Content); err != nil { continue } }