diff options
Diffstat (limited to 'weed/filesys/filehandle.go')
| -rw-r--r-- | weed/filesys/filehandle.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 9fa971236..32e4622d0 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -11,6 +11,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/util" "strings" "sync" + "net/http" ) type FileHandle struct { @@ -18,10 +19,6 @@ type FileHandle struct { dirtyPages *ContinuousDirtyPages dirtyMetadata bool - cachePath string - - handle uint64 - f *File RequestId fuse.RequestID // unique ID for request NodeId fuse.NodeID // file or directory the request is about @@ -135,6 +132,11 @@ 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.dirtyMetadata = true + } + if chunk != nil { fh.f.Chunks = append(fh.f.Chunks, chunk) glog.V(1).Infof("uploaded %s/%s to %s [%d,%d)", fh.f.dir.Path, fh.f.Name, chunk.FileId, chunk.Offset, chunk.Offset+int64(chunk.Size)) |
