• Kale Blankenship's avatar
    net/url: prefix relative paths containing ":" in the first segment with "./" · ad5d91c1
    Kale Blankenship authored
    This change modifies URL.String to prepend "./" to a relative URL which
    contains a colon in the first path segment.
    
    Per RFC 3986 §4.2:
    
    > A path segment that contains a colon character (e.g., "this:that")
    > cannot be used as the first segment of a relative-path reference, as
    > it would be mistaken for a scheme name.  Such a segment must be
    > preceded by a dot-segment (e.g., "./this:that") to make a relative-
    > path reference.
    
    https://go-review.googlesource.com/27440 corrects the behavior for http.FileServer,
    but URL.String will still return an invalid URL. This CL reverts the changes to
    http.FileServer as they are unnecessary with this fix.
    
    Fixes #17184
    
    Change-Id: I9211ae20f82c91b785d1b079b2cd766487d94225
    Reviewed-on: https://go-review.googlesource.com/29610Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    ad5d91c1
url_test.go 36.8 KB