mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 13:00:37 +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:
@ -636,7 +636,13 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pth, err = filepath.EvalSymlinks(pth)
|
||||||
|
if err != nil {
|
||||||
|
log.Debugf("filepath.EvalSymlinks error: %s", err)
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
var du uint64
|
var du uint64
|
||||||
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
|
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user