10 func parse(rawURL string) (*url.URL, error) {
11 // Make sure we're using "/" since URLs are "/"-based.
12 rawURL = filepath.ToSlash(rawURL)
14 if len(rawURL) > 1 && rawURL[1] == ':' {
15 // Assume we're dealing with a drive letter. In which case we
16 // force the 'file' scheme to avoid "net/url" URL.String() prepending
18 rawURL = "file://" + rawURL
21 u, err := url.Parse(rawURL)
26 if len(u.Host) > 1 && u.Host[1] == ':' && strings.HasPrefix(rawURL, "file://") {
27 // Assume we're dealing with a drive letter file path where the drive
28 // letter has been parsed into the URL Host.
29 u.Path = fmt.Sprintf("%s%s", u.Host, u.Path)
33 // Remove leading slash for absolute file paths.
34 if len(u.Path) > 2 && u.Path[0] == '/' && u.Path[2] == ':' {