From b670cdb29af73ab7786cc4958bbac1fe71d5ab90 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 17 May 2024 21:42:42 +0800 Subject: [PATCH 1/3] :bug: Negative numbers are treated as positive numbers when calculating template field values https://github.com/siyuan-note/siyuan/issues/11446 --- kernel/util/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/util/misc.go b/kernel/util/misc.go index c319083bf..97c758126 100644 --- a/kernel/util/misc.go +++ b/kernel/util/misc.go @@ -124,7 +124,7 @@ func Convert2Float(s string) (float64, bool) { s = strings.ReplaceAll(s, ",", "") buf := bytes.Buffer{} for _, r := range s { - if unicode.IsDigit(r) || '.' == r { + if unicode.IsDigit(r) || '.' == r || '-' == r { buf.WriteRune(r) } } From ad58e1c0c9c6cc58b3e36255f4b1322d19877f4f Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 17 May 2024 21:50:35 +0800 Subject: [PATCH 2/3] :bug: Regular replacement text fails https://github.com/siyuan-note/siyuan/issues/11444 --- kernel/model/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/search.go b/kernel/model/search.go index ff260314a..7fc301044 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -803,7 +803,7 @@ func replaceTextNode(text *ast.Node, method int, keyword string, replacement str } } else if 3 == method { if nil != r && r.MatchString(string(text.Tokens)) { - newContent := bytes.ReplaceAll(text.Tokens, []byte(keyword), []byte(replacement)) + newContent := []byte(r.ReplaceAllString(string(text.Tokens), replacement)) tree := parse.Inline("", newContent, luteEngine.ParseOptions) if nil == tree.Root.FirstChild { return false From 8a47d448848e6b3f332fea149ffe3a9c6bd6d9b1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 17 May 2024 21:58:38 +0800 Subject: [PATCH 3/3] :art: Add logging https://github.com/siyuan-note/siyuan/issues/11447 --- kernel/model/import.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/model/import.go b/kernel/model/import.go index 150912a9b..409f1fb1c 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -115,12 +115,13 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { return } if 1 != len(unzipRootPaths) { - logging.LogErrorf("invalid .sy.zip") + logging.LogErrorf("invalid .sy.zip [%v]", unzipRootPaths) return errors.New(Conf.Language(199)) } unzipRootPath := unzipRootPaths[0] name := filepath.Base(unzipRootPath) if strings.HasPrefix(name, "data-20") && len("data-20230321175442") == len(name) { + logging.LogErrorf("invalid .sy.zip [unzipRootPath=%s, baseName=%s]", unzipRootPath, name) return errors.New(Conf.Language(199)) }