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.

S3: stamp the gateway's own uid/gid on PutObject and copy entries (#10844)

Chris Luabd61de52c2d
diff --git a/weed/s3api/s3api_object_handlers_copy.go b/weed/s3api/s3api_object_handlers_copy.go
index 846e4b7bc7..634c7aed47 100644
--- a/weed/s3api/s3api_object_handlers_copy.go
+++ b/weed/s3api/s3api_object_handlers_copy.go
@@ -329,6 +329,9 @@ func (s3a *S3ApiServer) CopyObjectHandler(w http.ResponseWriter, r *http.Request
Mtime: t.Unix(),
Crtime: entry.Attributes.Crtime,
Mime: resolveDestinationMime(r.Header, entry.Attributes.Mime, replaceMeta),
+ FileMode: s3a.resolveFileMode(r),
+ Uid: filer_pb.OS_UID,
+ Gid: filer_pb.OS_GID,
},
Extended: make(map[string][]byte),
}
@@ -1030,6 +1033,9 @@ func (s3a *S3ApiServer) CopyObjectPartHandler(w http.ResponseWriter, r *http.Req
Mtime: t.Unix(),
Crtime: t.Unix(),
Mime: entry.Attributes.Mime,
+ FileMode: s3a.resolveFileMode(r),
+ Uid: filer_pb.OS_UID,
+ Gid: filer_pb.OS_GID,
},
Extended: make(map[string][]byte),
}
diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go
index 5f8652ac78..6c56dc2107 100644
--- a/weed/s3api/s3api_object_handlers_put.go
+++ b/weed/s3api/s3api_object_handlers_put.go
@@ -694,8 +694,8 @@ func (s3a *S3ApiServer) putToFiler(r *http.Request, filePath string, dataReader
Crtime: now.Unix(),
Mtime: now.Unix(),
FileMode: fileMode,
- Uid: 0,
- Gid: 0,
+ Uid: filer_pb.OS_UID,
+ Gid: filer_pb.OS_GID,
Mime: mimeType,
FileSize: uint64(chunkResult.TotalSize),
TtlSec: lifecycleTTLSec,