Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

filer: set file name when uploading to a directory

Chris Lu1d1b355f9ea4
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index 30fd267022..0bf1218ce4 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -150,15 +150,15 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
}()
path := r.URL.Path
+ if strings.HasSuffix(path, "/") {
+ if ret.Name != "" {
+ path += ret.Name
+ }
+ }
existingEntry, err := fs.filer.FindEntry(ctx, filer2.FullPath(path))
crTime := time.Now()
if err == nil && existingEntry != nil {
- // glog.V(4).Infof("existing %s => %+v", path, existingEntry)
- if existingEntry.IsDirectory() {
- path += "/" + ret.Name
- } else {
- crTime = existingEntry.Crtime
- }
+ crTime = existingEntry.Crtime
}
entry := &filer2.Entry{
FullPath: filer2.FullPath(path),