MCPcopy Create free account
hub / github.com/aptly-dev/aptly / validBucketName

Function validBucketName

s3/server_test.go:539–558  ·  view source on GitHub ↗

validBucketName returns whether name is a valid bucket name. Here are the rules, from: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/BucketRestrictions.html Can contain lowercase letters, numbers, periods (.), underscores (_), and dashes (-). You can use uppercase letters for buckets on

(name string)

Source from the content-addressed store, hash-verified

537// but the real S3 server does not seem to check that rule, so we will not
538// check it either.
539func validBucketName(name string) bool {
540 if len(name) < 3 || len(name) > 255 {
541 return false
542 }
543 r := name[0]
544 if r < '0' || (r > '9' && r < 'a') || r > 'z' {
545 return false
546 }
547 for _, r := range name {
548 switch {
549 case r >= '0' && r <= '9':
550 case r >= 'a' && r <= 'z':
551 case r == '_' || r == '-':
552 case r == '.':
553 default:
554 return false
555 }
556 }
557 return true
558}
559
560var responseParams = map[string]bool{
561 "content-type": true,

Callers 1

putMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected