diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go index bbb90306a7f38..aba1717e7d5e0 100644 --- a/src/path/filepath/path.go +++ b/src/path/filepath/path.go @@ -96,19 +96,14 @@ func Clean(path string) string { } return originalPath + "." } - - n := len(path) - if volLen > 2 && n == 1 && os.IsPathSeparator(path[0]) { - // UNC volume name with trailing slash. - return FromSlash(originalPath[:volLen]) - } rooted := os.IsPathSeparator(path[0]) // Invariants: // reading from path; r is index of next byte to process. - // writing to out; w is index of next byte to write. - // dotdot is index in out where .. must stop, either because + // writing to buf; w is index of next byte to write. + // dotdot is index in buf where .. must stop, either because // it is the leading slash or it is a leading ../../.. prefix. + n := len(path) out := lazybuf{path: path, volAndPath: originalPath, volLen: volLen} r, dotdot := 0, 0 if rooted { diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index 9c4c7ebedc3b4..7a434a4292493 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -93,9 +93,6 @@ var wincleantests = []PathTest{ {`//host/share/foo/../baz`, `\\host\share\baz`}, {`\\a\b\..\c`, `\\a\b\c`}, {`\\a\b`, `\\a\b`}, - {`\\a\b\`, `\\a\b`}, - {`\\folder\share\foo`, `\\folder\share\foo`}, - {`\\folder\share\foo\`, `\\folder\share\foo`}, } func TestClean(t *testing.T) {