diff --git a/volume/local/local.go b/volume/local/local.go index 30aa9de4b7..6b1c4f76e6 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -256,6 +256,9 @@ func (r *Root) Scope() string { } func (r *Root) validateName(name string) error { + if len(name) == 1 { + return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")} + } if !volumeNameRegex.MatchString(name) { return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed", name, utils.RestrictedNameChars)} } diff --git a/volume/local/local_test.go b/volume/local/local_test.go index 6b9ce55db9..fd1af411d5 100644 --- a/volume/local/local_test.go +++ b/volume/local/local_test.go @@ -138,6 +138,7 @@ func TestCreate(t *testing.T) { func TestValidateName(t *testing.T) { r := &Root{} names := map[string]bool{ + "x": false, "/testvol": false, "thing.d": true, "hello-world": true,