From 89860f4197cb9bd2249c9ac4d854f3bc401a7926 Mon Sep 17 00:00:00 2001
From: Darrel Herbst <dherbst@gmail.com>
Date: Mon, 9 Oct 2017 06:45:30 -0400
Subject: [PATCH] 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
---
 swarm/fuse/fuse_file.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/swarm/fuse/fuse_file.go b/swarm/fuse/fuse_file.go
index 0cb59dfb3..32c85d02f 100644
--- a/swarm/fuse/fuse_file.go
+++ b/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
-- 
GitLab