Skip to content

Commit

Permalink
Merge pull request #2471 from thaJeztah/19.03_backport_fix_bind_panic
Browse files Browse the repository at this point in the history
[19.03 backport] fix panic on single-character volumes
  • Loading branch information
silvin-lubecki authored Apr 30, 2020
2 parents 7a2de81 + 4ad65fc commit 62baa3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/compose/loader/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func isFilePath(source string) bool {
case '.', '/', '~':
return true
}
if len([]rune(source)) == 1 {
return false
}

// windows named pipes
if strings.HasPrefix(source, `\\`) {
Expand Down
2 changes: 2 additions & 0 deletions cli/compose/loader/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ func TestParseVolumeWindowsNamedPipe(t *testing.T) {

func TestIsFilePath(t *testing.T) {
assert.Check(t, !isFilePath("a界"))
assert.Check(t, !isFilePath("1"))
assert.Check(t, !isFilePath("c"))
}

// Preserve the test cases for VolumeSplitN
Expand Down

0 comments on commit 62baa3c

Please sign in to comment.