Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-02-27 10:58:22 +08:00
commit 558c2d3dc2
2 changed files with 11 additions and 7 deletions

View file

@ -228,5 +228,11 @@ func CheckAuth(c *gin.Context) {
return
}
if u := c.Query("url"); "" != u {
c.Redirect(302, u)
c.Abort()
return
}
c.Next()
}

View file

@ -22,7 +22,6 @@ import (
"sort"
"strings"
"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/emirpasic/gods/sets/hashset"
"github.com/facette/natsort"
@ -155,12 +154,11 @@ func RenameTag(oldLabel, newLabel string) (err error) {
docTags := strings.Split(docTagsVal, ",")
var tmp []string
for _, docTag := range docTags {
if docTag != oldLabel {
if strings.HasPrefix(docTag, oldLabel+"/") || docTag == oldLabel {
docTag = strings.Replace(docTag, oldLabel, newLabel, 1)
tmp = append(tmp, docTag)
} else {
tmp = append(tmp, docTag)
continue
}
if !gulu.Str.Contains(newLabel, tmp) {
tmp = append(tmp, newLabel)
}
}
node.SetIALAttr("tags", strings.Join(tmp, ","))
@ -172,7 +170,7 @@ func RenameTag(oldLabel, newLabel string) (err error) {
for _, nodeTag := range nodeTags {
if nodeTag.IsTextMarkType("tag") {
if strings.HasPrefix(nodeTag.TextMarkTextContent, oldLabel+"/") || nodeTag.TextMarkTextContent == oldLabel {
nodeTag.TextMarkTextContent = strings.ReplaceAll(nodeTag.TextMarkTextContent, oldLabel, newLabel)
nodeTag.TextMarkTextContent = strings.Replace(nodeTag.TextMarkTextContent, oldLabel, newLabel, 1)
}
}
}