From 7df646b4e18b72e2d461bc752432f072f528a03f Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 28 May 2024 17:57:24 +0500 Subject: [PATCH] fix test_bucket_listv2_delimiter_basic --- weed/filer/filer.go | 2 +- weed/server/filer_server_handlers_write_autochunk.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/weed/filer/filer.go b/weed/filer/filer.go index de27c9af1..f6ffd67ce 100644 --- a/weed/filer/filer.go +++ b/weed/filer/filer.go @@ -304,7 +304,7 @@ func (f *Filer) ensureParentDirectoryEntry(ctx context.Context, entry *Entry, di } else if !dirEntry.IsDirectory() { glog.Errorf("CreateEntry %s: dir entry %+v should be a directory", entry.FullPath, dirEntry) - //return fmt.Errorf("%s is a file", dirPath) + return fmt.Errorf("%s is a file", dirPath) } return nil diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index f4428be61..b06ba60c6 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -266,7 +266,12 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa } } - if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil, skipCheckParentDirEntry(r), so.MaxFileNameLength); dbErr != nil { + dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil, skipCheckParentDirEntry(r), so.MaxFileNameLength) + // In test_bucket_listv2_delimiter_basic, the valid object key is the parent folder + if dbErr != nil && strings.HasSuffix(dbErr.Error(), " is a file") && r.Header.Get(s3_constants.AmzIdentityId) != "" { + dbErr = fs.filer.CreateEntry(ctx, entry, false, false, nil, true, so.MaxFileNameLength) + } + if dbErr != nil { replyerr = dbErr filerResult.Error = dbErr.Error() glog.V(0).Infof("failing to write %s to filer server : %v", path, dbErr)