aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/filepath')
-rw-r--r--src/path/filepath/path.go4
-rw-r--r--src/path/filepath/path_test.go1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index 1d8e35c969..e35ed5fefd 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -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
}
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index 921b23842b..70baa6112f 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -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`},