mirror of https://github.com/docker/cli.git
Merge pull request #2355 from thaJeztah/fix_bind_panic
fix panic on single-character volumes
This commit is contained in:
commit
59eee68015
|
@ -111,6 +111,9 @@ func isFilePath(source string) bool {
|
||||||
case '.', '/', '~':
|
case '.', '/', '~':
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if len([]rune(source)) == 1 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// windows named pipes
|
// windows named pipes
|
||||||
if strings.HasPrefix(source, `\\`) {
|
if strings.HasPrefix(source, `\\`) {
|
||||||
|
|
|
@ -162,6 +162,8 @@ func TestParseVolumeWindowsNamedPipe(t *testing.T) {
|
||||||
|
|
||||||
func TestIsFilePath(t *testing.T) {
|
func TestIsFilePath(t *testing.T) {
|
||||||
assert.Check(t, !isFilePath("a界"))
|
assert.Check(t, !isFilePath("a界"))
|
||||||
|
assert.Check(t, !isFilePath("1"))
|
||||||
|
assert.Check(t, !isFilePath("c"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preserve the test cases for VolumeSplitN
|
// Preserve the test cases for VolumeSplitN
|
||||||
|
|
Loading…
Reference in New Issue