Skip to content

Commit

Permalink
feat: not check sensitive if content empty
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Apr 2, 2024
1 parent af931a4 commit edd8dae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion models/hole.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package models

import (
"fmt"
"golang.org/x/exp/maps"
"time"

"github.com/gofiber/fiber/v2"
Expand Down Expand Up @@ -118,7 +119,7 @@ func loadTags(holes Holes) (err error) {
}

var tags Tags
err = DB.Where("id in ?", utils.Keys(tagIDs)).Find(&tags).Error
err = DB.Where("id in ?", maps.Keys(tagIDs)).Find(&tags).Error
if err != nil {
return err
}
Expand Down
9 changes: 8 additions & 1 deletion utils/sensitive/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/image/v5"
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/image/v5/check"
"strconv"
"strings"
"time"
"treehole_next/config"
"treehole_next/utils"
Expand Down Expand Up @@ -66,7 +67,13 @@ func CheckSensitive(params ParamsForCheck) (resp *ResponseForCheck, err error) {
Labels: nil,
}, nil
}
params.Content = clearContent
params.Content = strings.TrimSpace(clearContent)
if params.Content == "" {
return &ResponseForCheck{
Pass: true,
Labels: nil,
}, nil
}

return CheckSensitiveText(params)
}
Expand Down

0 comments on commit edd8dae

Please sign in to comment.