Skip to content

Commit

Permalink
Disallow uppercase in bucket names (#1801)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryfox authored Nov 5, 2024
1 parent 5345c8b commit 7d349a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fakestorage/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
"github.com/gorilla/mux"
)

var bucketRegexp = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$`)
// https://cloud.google.com/storage/docs/buckets#naming
var bucketRegexp = regexp.MustCompile(`^[a-z0-9][a-z0-9._-]*[a-z0-9]$`)

// CreateBucket creates a bucket inside the server, so any API calls that
// require the bucket name will recognize this bucket.
Expand Down
1 change: 1 addition & 0 deletions fakestorage/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func TestServerClientBucketCreateValidation(t *testing.T) {
"or spaces",
"don't even try",
"no/slashes/either",
"uppercaseNOTallowed",
}

for _, bucketName := range bucketNames {
Expand Down

0 comments on commit 7d349a4

Please sign in to comment.