mirror of
https://github.com/golang/go
synced 2024-11-25 09:17:57 -07:00
path/filepath: change IsAbs to treat \\host\share as an absolute path
Fixes #47123 Change-Id: I2226b8a9ea24cd88171acfbaffea2566309416de Reviewed-on: https://go-review.googlesource.com/c/go/+/334809 Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Hajime Hoshi <hajimehoshi@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
parent
946e2543f8
commit
8b471db71b
@ -791,6 +791,8 @@ var winisabstests = []IsAbsTest{
|
||||
{`c:a\b`, false},
|
||||
{`c:\a\b`, true},
|
||||
{`c:/a/b`, true},
|
||||
{`\\host\share`, true},
|
||||
{`\\host\share\`, true},
|
||||
{`\\host\share\foo`, true},
|
||||
{`//host/share/foo/bar`, true},
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ func IsAbs(path string) (b bool) {
|
||||
if l == 0 {
|
||||
return false
|
||||
}
|
||||
// If the volume name starts with a double slash, this is a UNC path.
|
||||
if isSlash(path[0]) && isSlash(path[1]) {
|
||||
return true
|
||||
}
|
||||
path = path[l:]
|
||||
if path == "" {
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user