fix(local): directory handle (#2262)

* fix(local): check symlink dir

* fix(local): set size of dir to 0 (close #2264)
This commit is contained in:
BoYanZh
2022-11-09 11:20:09 +08:00
committed by GitHub
parent e05e2fd663
commit cdcbfb24c4
2 changed files with 35 additions and 4 deletions

View File

@ -1 +1,22 @@
package local
import (
"io/fs"
"os"
"path/filepath"
)
func isSymlinkDir(f fs.FileInfo, path string) bool {
if f.Mode()&os.ModeSymlink == os.ModeSymlink {
dst, err := os.Readlink(filepath.Join(path, f.Name()))
if err != nil {
return false
}
stat, err := os.Stat(dst)
if err != nil {
return false
}
return stat.IsDir()
}
return false
}