skratchdot / open-golang

Open a file, directory, or URI using the OS's default application for that object type. Optionally, you can specify an application to use.
MIT License
783 stars 65 forks source link

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

Closed nixxquality closed 10 years ago

nixxquality commented 10 years ago

Testcase:

package main

import (
    "github.com/skratchdot/open-golang/open"
)

func main() {
    open.Start("http://127.0.0.1/?qwe&rty")
}

When this program is run on Windows, the URL http://127.0.0.1/?qwe is opened.

skratchdot commented 10 years ago

Ok. I tested it works on OSX. I'm going to try to test windows shortly (but need to spin up a VM). I might have to escape ampersands with a caret per: http://stackoverflow.com/a/1327476

I was hoping to not get into escaping of characters like this (thought exec.Command() might handle that), but it looks like I'll need to. I'll try testing a few different URL types (containing special characters), and if I get something working, I'll update this so you can test the fix...