From: Alex Brainman Date: Fri, 23 Mar 2012 04:57:19 +0000 (+1100) Subject: path/filepath: windows drive letter cannot be a digit X-Git-Tag: weekly~63 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f39ff80beaab4b366917575e5addcbdd551563c2;p=gostls13.git path/filepath: windows drive letter cannot be a digit R=golang-dev, r CC=golang-dev, mattn.jp https://golang.org/cl/5885056 --- diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go index 87cb5e5530..2aba553d23 100644 --- a/src/pkg/path/filepath/path_test.go +++ b/src/pkg/path/filepath/path_test.go @@ -814,6 +814,7 @@ type VolumeNameTest struct { var volumenametests = []VolumeNameTest{ {`c:/foo/bar`, `c:`}, {`c:`, `c:`}, + {`2:`, ``}, {``, ``}, {`\\\host`, ``}, {`\\\host\`, ``}, diff --git a/src/pkg/path/filepath/path_windows.go b/src/pkg/path/filepath/path_windows.go index 1d1d23bfe7..3dcd030219 100644 --- a/src/pkg/path/filepath/path_windows.go +++ b/src/pkg/path/filepath/path_windows.go @@ -35,9 +35,7 @@ func VolumeName(path string) (v string) { } // with drive letter c := path[0] - if path[1] == ':' && - ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || - 'A' <= c && c <= 'Z') { + if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') { return path[:2] } // is it UNC