fixes #6 - (Windows) open.Start does not correctly handle URLs with

ampersands
This commit is contained in:
skratchdot 2014-06-19 16:05:56 -04:00
parent 1bdd1ce936
commit a09a2535ca
1 changed files with 8 additions and 2 deletions

View File

@ -4,12 +4,18 @@ package open
import ( import (
"os/exec" "os/exec"
"strings"
) )
func cleaninput(input string) string {
r := strings.NewReplacer("&", "^&")
return r.Replace(input)
}
func open(input string) *exec.Cmd { func open(input string) *exec.Cmd {
return exec.Command("cmd", "/C", "start", "", input) return exec.Command("cmd", "/C", "start", "", cleaninput(input))
} }
func openWith(input string, appName string) *exec.Cmd { func openWith(input string, appName string) *exec.Cmd {
return exec.Command("cmd", "/C", "start", "", appName, input) return exec.Command("cmd", "/C", "start", "", appName, cleaninput(input))
} }