Commit 34b455da authored by Yasuhiro Matsumoto's avatar Yasuhiro Matsumoto Committed by Alex Brainman

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/35690Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 769be04f
......@@ -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`},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment