mirror of https://github.com/docker/cli.git
Merge pull request #2471 from thaJeztah/19.03_backport_fix_bind_panic
[19.03 backport] fix panic on single-character volumes
This commit is contained in:
commit
62baa3ce57
|
@ -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