Skip to content

Commit

Permalink
fix: xml解析
Browse files Browse the repository at this point in the history
  • Loading branch information
Ackites committed Aug 15, 2024
1 parent 456e847 commit 43cebb4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/unpack/uxml.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,15 @@ func (p *XmlParser) Parse(option config.WxapkgInfo) error {

// 防止报错
patch := `var noCss=true;var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};
document={getElementsByTagName:()=>{}};function define(){};function require(){};`
document={getElementsByTagName:()=>{}};function define(){};function require(){};
var setCssToHead=function(file,_xcInvalid,info){return ()=>{}};`

// 如果是 html 文件,提取 script 代码
if strings.HasSuffix(frameFile, ".html") {
scriptCode = matchScripts(codeStr)
}

scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", 1)
scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", -1)
scriptCode = strings.Replace(scriptCode, "var noCss", "var noCss2", -1)
// 如果是子包
if isSubpackage(&option) {
Expand Down

0 comments on commit 43cebb4

Please sign in to comment.