mirror of
https://github.com/minio/minio.git
synced 2025-11-28 13:09:09 -05:00
Simplifying bucket name convention and making convention public
This commit is contained in:
@@ -18,6 +18,7 @@ package storage
|
||||
|
||||
import (
|
||||
"io"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Storage interface {
|
||||
@@ -43,3 +44,17 @@ type ObjectMetadata struct {
|
||||
Size int
|
||||
ETag string
|
||||
}
|
||||
|
||||
func IsValidBucket(bucket string) bool {
|
||||
if len(bucket) < 3 || len(bucket) > 63 {
|
||||
return false
|
||||
}
|
||||
if bucket[0] == '.' || bucket[len(bucket)-1] == '.' {
|
||||
return false
|
||||
}
|
||||
if match, _ := regexp.MatchString("\\.\\.", bucket); match == true {
|
||||
return false
|
||||
}
|
||||
match, _ := regexp.MatchString("[a-zA-Z0-9\\.\\-]", bucket)
|
||||
return match
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user