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.

ensure using none nil attributes

Chris Luc8234a5af6ca
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 74125dc093..03eed0a6f8 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -18,6 +18,7 @@ type FileHandle struct {
// cache file has been written to
dirtyPages *ContinuousDirtyPages
dirtyMetadata bool
+ contentType string
handle uint64
@@ -145,7 +146,7 @@ func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *f
resp.Size = len(req.Data)
if req.Offset == 0 {
- fh.f.attributes.Mime = http.DetectContentType(req.Data)
+ fh.contentType = http.DetectContentType(req.Data)
fh.dirtyMetadata = true
}
@@ -197,6 +198,10 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
err = fh.f.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
+ if fh.f.attributes != nil {
+ fh.f.attributes.Mime = fh.contentType
+ }
+
request := &filer_pb.UpdateEntryRequest{
Directory: fh.f.dir.Path,
Entry: &filer_pb.Entry{