diff options
| author | chrislu <chris.lu@gmail.com> | 2022-07-26 23:12:25 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-07-26 23:12:25 -0700 |
| commit | f401b996eb421294920fe048df5b1b646a558324 (patch) | |
| tree | 6cbe40639f124d2cc2861c0d6175af289003f898 | |
| parent | f18bc2d9dd9be4d62ba983fd263352495cb12063 (diff) | |
| download | seaweedfs-f401b996eb421294920fe048df5b1b646a558324.tar.xz seaweedfs-f401b996eb421294920fe048df5b1b646a558324.zip | |
mount: fix symlink size reporting
| -rw-r--r-- | weed/mount/weedfs_attr.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go index e31c170cb..dc7a3bc85 100644 --- a/weed/mount/weedfs_attr.go +++ b/weed/mount/weedfs_attr.go @@ -143,6 +143,9 @@ func (wfs *WFS) setAttrByPbEntry(out *fuse.Attr, inode uint64, entry *filer_pb.E out.Ino = entry.Attributes.Inode } out.Size = filer.FileSize(entry) + if entry.FileMode()&os.ModeSymlink != 0 { + out.Size = uint64(len(entry.Attributes.SymlinkTarget)) + } out.Blocks = (out.Size + blockSize - 1) / blockSize setBlksize(out, blockSize) if entry == nil { @@ -165,6 +168,9 @@ func (wfs *WFS) setAttrByPbEntry(out *fuse.Attr, inode uint64, entry *filer_pb.E func (wfs *WFS) setAttrByFilerEntry(out *fuse.Attr, inode uint64, entry *filer.Entry) { out.Ino = inode out.Size = entry.FileSize + if entry.Mode&os.ModeSymlink != 0 { + out.Size = uint64(len(entry.SymlinkTarget)) + } out.Blocks = (out.Size + blockSize - 1) / blockSize setBlksize(out, blockSize) out.Atime = uint64(entry.Attr.Mtime.Unix()) |
