common: replace windows file URL backslash with forward slash
/cc @jasonberanek - Just adding this as well because I see this being common as well.
This commit is contained in:
parent
c2654ddb59
commit
2b41f05848
|
@ -78,6 +78,11 @@ func DownloadableURL(original string) (string, error) {
|
||||||
// since net/url turns "C:/" into "/C:/"
|
// since net/url turns "C:/" into "/C:/"
|
||||||
if runtime.GOOS == "windows" && url.Path[0] == '/' {
|
if runtime.GOOS == "windows" && url.Path[0] == '/' {
|
||||||
url.Path = url.Path[1:len(url.Path)]
|
url.Path = url.Path[1:len(url.Path)]
|
||||||
|
|
||||||
|
// Also replace all backslashes with forwardslashes since Windows
|
||||||
|
// users are likely to do this but the URL should actually only
|
||||||
|
// contain forward slashes.
|
||||||
|
url.Path = strings.Replace(url.Path, `\`, `/`, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(url.Path); err != nil {
|
if _, err := os.Stat(url.Path); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue