diff options
| author | chrislu <chris.lu@gmail.com> | 2025-02-01 14:11:57 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-02-01 14:11:57 -0800 |
| commit | 42efade0dc2ee2127a1f564ffb496e7c34b12321 (patch) | |
| tree | a40193e2f133d87b9640b84ab6cab0a893867cd9 | |
| parent | a75271dd43fcec0105ee1fda156622df45a8b2cd (diff) | |
| download | seaweedfs-42efade0dc2ee2127a1f564ffb496e7c34b12321.tar.xz seaweedfs-42efade0dc2ee2127a1f564ffb496e7c34b12321.zip | |
adjust fix
fix https://github.com/seaweedfs/seaweedfs/issues/6497
| -rw-r--r-- | weed/filer/filer.go | 10 | ||||
| -rw-r--r-- | weed/s3api/s3bucket/s3api_bucket_test.go | 1 |
2 files changed, 7 insertions, 4 deletions
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-", "----------", |
