mxs пре 4 месеци
родитељ
комит
598235cd13
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      src/spider/script.go

+ 3 - 2
src/spider/script.go

@@ -834,7 +834,8 @@ func (s *Script) LoadScript(site, channel, user *string, code, script_file strin
 		text := S.ToString(-3)
 		old := S.ToString(-2)
 		repl := S.ToString(-1)
-		text = strings.Replace(text, old, repl, n)
+		reg := regexp.MustCompile(old)
+		text = reg.ReplaceAllString(text, repl)
 		S.Push(lua.LString(text))
 		return 1
 	}))
@@ -1145,7 +1146,7 @@ func (s *Script) LoadScript(site, channel, user *string, code, script_file strin
 		if err == nil {
 			headJsonStr = string(headByte)
 		}
-		code, respHead, respCookie := codegrpc.GetCodeByPath(path, stype, headJsonStr, cookie, proxy)
+		code, respHead, respCookie := codegrpc.GetCodeByPath(s.SCode, path, stype, headJsonStr, cookie, proxy)
 		//qu.Debug("code====", code)
 		//qu.Debug("respHead====", respHead)
 		//qu.Debug("respCookie====", respCookie)