handle sym links in when calculating repo size
repo/fsrepo: follow symbolic links when calculating RepoSize Now if the IPFS path is a symbolic it will be followed before calculating the repo size. License: MIT Signed-off-by: John Reed <john@re2d.xyz>
John Reed committed
Oct 14, 2017 at 08:59 UTC
07029ca32b1da05dc47d6cc54595b19a458e6292
1 file changed
+7
-1
repo/fsrepo/fsrepo.go
+7
-1
@@ -636,7 +636,13 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
636
if err != nil {
637
return 0, err
638
}
639
-
639
+
640
+ pth, err = filepath.EvalSymlinks(pth)
641
+ if err != nil {
642
+ log.Debugf("filepath.EvalSymlinks error: %s", err)
643
+ return 0, err
644
+ }
645
+
646
var du uint64
647
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
648
if err != nil {