chrislu 13 hours ago
parent
commit
42efade0dc
  1. 10
      weed/filer/filer.go
  2. 1
      weed/s3api/s3bucket/s3api_bucket_test.go

10
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)
}
}

1
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-",
"----------",

Loading…
Cancel
Save