mirror of
https://github.com/golang/go
synced 2024-11-19 00:44:40 -07:00
path/filepath: ignore dot for Dir(\\server\share
)
Dir(`\\server\share`) returns `\\server\share.`. Change Dir so it returns `\\server\share` instead. Fixes #18783 Change-Id: I9e0dd71ea6aea85e6c6114aaa4bb3bea3270d818 Reviewed-on: https://go-review.googlesource.com/35690 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
769be04feb
commit
34b455da44
@ -461,6 +461,10 @@ func Dir(path string) string {
|
||||
i--
|
||||
}
|
||||
dir := Clean(path[len(vol) : i+1])
|
||||
if dir == "." && len(vol) > 2 {
|
||||
// must be UNC
|
||||
return vol
|
||||
}
|
||||
return vol + dir
|
||||
}
|
||||
|
||||
|
@ -665,6 +665,7 @@ var windirtests = []PathTest{
|
||||
{`c:\a\b`, `c:\a`},
|
||||
{`c:a\b`, `c:a`},
|
||||
{`c:a\b\c`, `c:a\b`},
|
||||
{`\\host\share`, `\\host\share`},
|
||||
{`\\host\share\`, `\\host\share\`},
|
||||
{`\\host\share\a`, `\\host\share\`},
|
||||
{`\\host\share\a\b`, `\\host\share\a`},
|
||||
|
Loading…
Reference in New Issue
Block a user