From 507e8d522278755e9bdd8694ed936eeae8130a03 Mon Sep 17 00:00:00 2001 From: "Lea\\Anthony" Date: Tue, 30 Nov 2021 19:02:20 +1100 Subject: [PATCH] [v2] Fix slash escaping in git username --- v2/pkg/git/git.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v2/pkg/git/git.go b/v2/pkg/git/git.go index 844fd452f..319c5672b 100644 --- a/v2/pkg/git/git.go +++ b/v2/pkg/git/git.go @@ -1,7 +1,9 @@ package git import ( + "html/template" "runtime" + "strings" "github.com/wailsapp/wails/v2/internal/shell" ) @@ -29,7 +31,8 @@ func Email() (string, error) { // Name tries to retrieve the func Name() (string, error) { stdout, _, err := shell.RunCommand(".", gitcommand(), "config", "user.name") - return stdout, err + name := template.JSEscapeString(strings.TrimSpace(stdout)) + return name, err } func InitRepo(projectDir string) error {