mirror of
https://github.com/minio/minio.git
synced 2026-02-05 02:10:14 -05:00
Fix check for bucket name: (#3832)
* Do not allow bucket names with adjacent hypen and periods. * Improve performance by eliminating the usage of regular expressions.
This commit is contained in:
committed by
Harshavardhana
parent
6c00a57a7c
commit
6df7bc42b8
@@ -41,6 +41,8 @@ func TestIsValidBucketName(t *testing.T) {
|
||||
{"testbucket", true},
|
||||
{"1bucket", true},
|
||||
{"bucket1", true},
|
||||
{"a.b", true},
|
||||
{"ab.a.bc", true},
|
||||
// cases for which test should fail.
|
||||
// passing invalid bucket names.
|
||||
{"------", false},
|
||||
@@ -59,11 +61,14 @@ func TestIsValidBucketName(t *testing.T) {
|
||||
{"ends-with-a-dot.", false},
|
||||
{"ends-with-a-dash-", false},
|
||||
{"-starts-with-a-dash", false},
|
||||
{"THIS-BEINGS-WITH-UPPERCASe", false},
|
||||
{"THIS-BEGINS-WITH-UPPERCASe", false},
|
||||
{"tHIS-ENDS-WITH-UPPERCASE", false},
|
||||
{"ThisBeginsAndEndsWithUpperCase", false},
|
||||
{"ThisBeginsAndEndsWithUpperCasE", false},
|
||||
{"una ñina", false},
|
||||
{"lalalallalallalalalallalallalala-theString-size-is-greater-than-64", false},
|
||||
{"dash-.may-not-appear-next-to-dot", false},
|
||||
{"dash.-may-not-appear-next-to-dot", false},
|
||||
{"dash-.-may-not-appear-next-to-dot", false},
|
||||
{"lalalallalallalalalallalallalala-thestring-size-is-greater-than-63", false},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user