diff --git a/weed/filer/filer.go b/weed/filer/filer.go index df377a135..91ba0819a 100644 --- a/weed/filer/filer.go +++ b/weed/filer/filer.go @@ -248,7 +248,7 @@ func (f *Filer) ensureParentDirectoryEntry(ctx context.Context, entry *Entry, di } dirPath := "/" + util.Join(dirParts[:level]...) - // fmt.Printf("%d directory: %+v\n", i, dirPath) + // fmt.Printf("%d dirPath: %+v\n", level, dirPath) // check the store directly glog.V(4).Infof("find uncached directory: %s", dirPath) @@ -257,9 +257,11 @@ func (f *Filer) ensureParentDirectoryEntry(ctx context.Context, entry *Entry, di // no such existing directory if dirEntry == nil { - if len(dirParts) >= 2 && level == 2 && dirParts[0] == "buckets" { - if err := s3bucket.VerifyS3BucketName(dirParts[1]); err != nil { - return fmt.Errorf("invalid bucket name %s: %v", dirParts[1], err) + // fmt.Printf("dirParts: %v %v %v\n", dirParts[0], dirParts[1], dirParts[2]) + // dirParts[0] == "" and dirParts[1] == "buckets" + if len(dirParts) >= 3 && dirParts[1] == "buckets" { + if err := s3bucket.VerifyS3BucketName(dirParts[2]); err != nil { + return fmt.Errorf("invalid bucket name %s: %v", dirParts[2], err) } } diff --git a/weed/s3api/s3bucket/s3api_bucket_test.go b/weed/s3api/s3bucket/s3api_bucket_test.go index b331a793a..9ada225ef 100644 --- a/weed/s3api/s3bucket/s3api_bucket_test.go +++ b/weed/s3api/s3bucket/s3api_bucket_test.go @@ -11,6 +11,7 @@ func Test_verifyBucketName(t *testing.T) { "123.12.153.10", "abc214..2", "d", + "aa", ".ewfs3253543", "grehtrry-", "----------",