aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-12 15:03:42 +0200
committerJakob Unterwurzacher2020-07-12 15:03:42 +0200
commit4d99b02279dce3ef7d37ca219d1305b81f716741 (patch)
tree230ca6a8ac540bb56e3dc5c785da028dbbdbe3ce /internal/fusefrontend/node.go
parent0d385846dae33dcac8bd0be6837c0c3a6def8875 (diff)
v2api: Getattr: fix file size
Diffstat (limited to 'internal/fusefrontend/node.go')
-rw-r--r--internal/fusefrontend/node.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go
index 2c9a4f7..69d9b22 100644
--- a/internal/fusefrontend/node.go
+++ b/internal/fusefrontend/node.go
@@ -97,8 +97,22 @@ func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut)
if err != nil {
return fs.ToErrno(err)
}
- n.rootNode().inoMap.TranslateStat(st)
+
+ // Fix inode number
+ rn := n.rootNode()
+ rn.inoMap.TranslateStat(st)
out.Attr.FromStat(st)
+
+ // Fix size
+ if out.IsRegular() {
+ out.Size = rn.contentEnc.CipherSizeToPlainSize(out.Size)
+ } else if out.IsSymlink() {
+ target, _ := n.Readlink(ctx)
+ out.Size = uint64(len(target))
+ }
+ if rn.args.ForceOwner != nil {
+ out.Owner = *rn.args.ForceOwner
+ }
return 0
}