Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 7068179

Browse files
Merge pull request #2471 from thaJeztah/19.03_backport_fix_bind_panic
[19.03 backport] fix panic on single-character volumes Upstream-commit: 62baa3ce57a25f98366ca056c306492373658ace Component: cli
2 parents 16dc5c5 + 1eae0fe commit 7068179

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

components/cli/cli/compose/loader/volume.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func isFilePath(source string) bool {
111111
case '.', '/', '~':
112112
return true
113113
}
114+
if len([]rune(source)) == 1 {
115+
return false
116+
}
114117

115118
// windows named pipes
116119
if strings.HasPrefix(source, `\\`) {

components/cli/cli/compose/loader/volume_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ func TestParseVolumeWindowsNamedPipe(t *testing.T) {
162162

163163
func TestIsFilePath(t *testing.T) {
164164
assert.Check(t, !isFilePath("a界"))
165+
assert.Check(t, !isFilePath("1"))
166+
assert.Check(t, !isFilePath("c"))
165167
}
166168

167169
// Preserve the test cases for VolumeSplitN

0 commit comments

Comments
 (0)