From f39ff80beaab4b366917575e5addcbdd551563c2 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Fri, 23 Mar 2012 15:57:19 +1100 Subject: [PATCH] path/filepath: windows drive letter cannot be a digit R=golang-dev, r CC=golang-dev, mattn.jp https://golang.org/cl/5885056 --- src/pkg/path/filepath/path_test.go | 1 + src/pkg/path/filepath/path_windows.go | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) 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