Browse Source

swarm/fuse: return amount of data written if the file exists (#15261)

If the file already existed, the WriteResponse.Size was being set
as the length of the entire file, not just the amount that was
written to the existing file.

Fixes #15216
Darrel Herbst 8 years ago
parent
commit
89860f4197
1 changed files with 1 additions and 1 deletions
  1. 1 1
      swarm/fuse/fuse_file.go

+ 1 - 1
swarm/fuse/fuse_file.go

@@ -134,7 +134,7 @@ func (sf *SwarmFile) Write(ctx context.Context, req *fuse.WriteRequest, resp *fu
 		if err != nil {
 			return err
 		}
-		resp.Size = int(sf.fileSize)
+		resp.Size = len(req.Data)
 	} else {
 		log.Warn("Invalid write request size(%v) : off(%v)", sf.fileSize, req.Offset)
 		return errInvalidOffset