Skip to content

Commit

Permalink
Escape bindings, even though we generate them internally.
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Mar 2, 2024
1 parent 5d22da4 commit 964abcc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion v2/pkg/assetserver/assetserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"golang.org/x/net/html"
"html/template"

"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
Expand Down Expand Up @@ -67,9 +68,11 @@ func NewAssetServer(bindingsJSON string, options assetserver.Options, servingFro
}

func NewAssetServerWithHandler(handler http.Handler, bindingsJSON string, servingFromDisk bool, logger Logger, runtime RuntimeAssets) (*AssetServer, error) {

var buffer bytes.Buffer
if bindingsJSON != "" {
buffer.WriteString(`window.wailsbindings='` + bindingsJSON + `';` + "\n")
escapedBindingsJSON := template.JSEscapeString(bindingsJSON)
buffer.WriteString(`window.wailsbindings='` + escapedBindingsJSON + `';` + "\n")
}
buffer.Write(runtime.RuntimeDesktopJS())

Expand Down

0 comments on commit 964abcc

Please sign in to comment.