1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-02 03:28:25 +08:00

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>
This commit is contained in:
John Reed
2017-10-14 08:59:24 -05:00
committed by GitHub
parent 786d81eda5
commit 07029ca32b

View File

@ -636,7 +636,13 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
if err != nil {
return 0, err
}
pth, err = filepath.EvalSymlinks(pth)
if err != nil {
log.Debugf("filepath.EvalSymlinks error: %s", err)
return 0, err
}
var du uint64
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
if err != nil {