Skip to content

net/url: Parsing of absolute Windows filepaths without scheme #13276

@JaCoB1123

Description

@JaCoB1123

Parsing a Windows filepath without scheme yields an invalid url:
Examples: https://play.golang.org/p/QuBFiU_1b1

# Working when prefixed with file:///
file:///c:\foo\bar
Scheme: file
Host: 
Path: /c:\foo\bar

file:///c:/foo/bar
Scheme: file
Host: 
Path: /c:/foo/bar

# Not working with only 2 leading slashes
file://c:\foo\bar
Scheme: file
Host: c:\foo\bar
Path: 

# Host containing colon but without port should not be valid?
file://c:/foo/bar
Scheme: file
Host: c:
Path: /foo/bar

# Expected: Scheme: empty, Path: input
c:\foo\bar
Scheme: c
Host: 
Path: 

# Expected: Scheme: empty, Path: input
c:/foo/bar
Scheme: c
Host: 
Path: /foo/bar

The middle two tests aren't real bugs though, I guess.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions