Procházet zdrojové kódy

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

Vanessa před 1 rokem
rodič
revize
34a487b2d0
3 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 2 1
      kernel/model/import.go
  2. 1 1
      kernel/model/search.go
  3. 1 1
      kernel/util/misc.go

+ 2 - 1
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))
 	}
 

+ 1 - 1
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

+ 1 - 1
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)
 		}
 	}