From 519b0e1e4909d875988cee83f8dad5100e3df256 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 12 Apr 2021 11:56:56 -0700 Subject: [PATCH] filer: upload to a directory without "/" suffix fix https://github.com/chrislusf/seaweedfs/issues/1988 --- weed/server/filer_server_handlers_write_autochunk.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index 2808042c7..c4f10d94e 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -142,6 +142,14 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa if fileName != "" { path += fileName } + } else { + if fileName != "" { + if possibleDirEntry, findDirErr := fs.filer.FindEntry(ctx, util.FullPath(path)); findDirErr == nil { + if possibleDirEntry.IsDirectory() { + path += "/" + fileName + } + } + } } var entry *filer.Entry