Commit 89860f41 authored by Darrel Herbst's avatar Darrel Herbst Committed by Felix Lange

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
parent 88b1db72
...@@ -134,7 +134,7 @@ func (sf *SwarmFile) Write(ctx context.Context, req *fuse.WriteRequest, resp *fu ...@@ -134,7 +134,7 @@ func (sf *SwarmFile) Write(ctx context.Context, req *fuse.WriteRequest, resp *fu
if err != nil { if err != nil {
return err return err
} }
resp.Size = int(sf.fileSize) resp.Size = len(req.Data)
} else { } else {
log.Warn("Invalid write request size(%v) : off(%v)", sf.fileSize, req.Offset) log.Warn("Invalid write request size(%v) : off(%v)", sf.fileSize, req.Offset)
return errInvalidOffset return errInvalidOffset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment