Commit f39ff80b authored by Alex Brainman's avatar Alex Brainman

path/filepath: windows drive letter cannot be a digit

R=golang-dev, r
CC=golang-dev, mattn.jp
https://golang.org/cl/5885056
parent d420be5b
......@@ -814,6 +814,7 @@ type VolumeNameTest struct {
var volumenametests = []VolumeNameTest{
{`c:/foo/bar`, `c:`},
{`c:`, `c:`},
{`2:`, ``},
{``, ``},
{`\\\host`, ``},
{`\\\host\`, ``},
......
......@@ -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
......
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