From 7c11b2ec9bc21ea90ddf487f640eda20029b46ac Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 27 Feb 2023 10:54:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=20=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E7=88=B6=E6=A0=87=E7=AD=BE=E8=AF=AF=E4=BF=AE=E6=94=B9=E5=AD=90?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=20https://github.com/siyuan-note/siyuan/issu?= =?UTF-8?q?es/7498?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/tag.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/model/tag.go b/kernel/model/tag.go index 172403afe..c6fea6020 100644 --- a/kernel/model/tag.go +++ b/kernel/model/tag.go @@ -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) } } } From 0a08db69aeb04701c428ab9daf0802aa1208bfec Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 27 Feb 2023 10:55:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E8=AE=BF=E9=97=AE=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E9=87=8D=E5=AE=9A=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/session.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/model/session.go b/kernel/model/session.go index 7042f2088..5e54ddfb2 100644 --- a/kernel/model/session.go +++ b/kernel/model/session.go @@ -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() }