]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / go-getter / helper / url / url_windows.go
index 4655226f66b7d7e0aca793a561dc065fd2a99bec..4280ec59a890e9a6461160b7fb923f1303716e39 100644 (file)
@@ -11,19 +11,18 @@ func parse(rawURL string) (*url.URL, error) {
        // Make sure we're using "/" since URLs are "/"-based.
        rawURL = filepath.ToSlash(rawURL)
 
+       if len(rawURL) > 1 && rawURL[1] == ':' {
+               // Assume we're dealing with a drive letter. In which case we
+               // force the 'file' scheme to avoid "net/url" URL.String() prepending
+               // our url with "./".
+               rawURL = "file://" + rawURL
+       }
+
        u, err := url.Parse(rawURL)
        if err != nil {
                return nil, err
        }
 
-       if len(rawURL) > 1 && rawURL[1] == ':' {
-               // Assume we're dealing with a drive letter file path where the drive
-               // letter has been parsed into the URL Scheme, and the rest of the path
-               // has been parsed into the URL Path without the leading ':' character.
-               u.Path = fmt.Sprintf("%s:%s", string(rawURL[0]), u.Path)
-               u.Scheme = ""
-       }
-
        if len(u.Host) > 1 && u.Host[1] == ':' && strings.HasPrefix(rawURL, "file://") {
                // Assume we're dealing with a drive letter file path where the drive
                // letter has been parsed into the URL Host.