@cryptotaxi247 / kubo / commits / bc0e31922

probably fix the cat bug

Jeromy committed Nov 7, 2014 at 13:06 UTC bc0e31922b02b1f96b91b7068fd0f8517589d785
1 file changed +9 -2
fuse/readonly/readonly_unix.go
+9 -2
@@ -98,13 +98,20 @@ func (s *Node) Attr() fuse.Attr {
98 switch s.cached.GetType() {
99 case ftpb.Data_Directory:
100 return fuse.Attr{Mode: os.ModeDir | 0555}
101 - case ftpb.Data_File, ftpb.Data_Raw:
102 - size, _ := s.Nd.Size()
101 + case ftpb.Data_File:
102 + size := s.cached.GetFilesize()
103 return fuse.Attr{
104 Mode: 0444,
105 Size: uint64(size),
106 Blocks: uint64(len(s.Nd.Links)),
107 }
108 + case ftpb.Data_Raw:
109 + return fuse.Attr{
110 + Mode: 0444,
111 + Size: uint64(len(s.cached.GetData())),
112 + Blocks: uint64(len(s.Nd.Links)),
113 + }
114 +
115 default:
116 log.Error("Invalid data type.")
117 return fuse.Attr{}