Skip to content

Commit

Permalink
fsdb: follow symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Jul 3, 2020
1 parent 9f04a3d commit 93ae50d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/fsdb/fsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ func Init(mp map[string]string, rt string) {
return nil
}
upathS := "/" + rt + strings.TrimPrefix(fpathS, bd)
s, _ := os.Stat(osPathname)
s, _ := os.Lstat(osPathname)
if s.IsDir() {
return nil
}
if s.Mode()&os.ModeSymlink != 0 {
realpath, _ := os.Readlink(osPathname)
s, _ = os.Lstat(filepath.Dir(osPathname) + "/" + realpath)
if s.IsDir() {
return nil
}
}
insertFile(&db.File{
0,
rt,
Expand Down

0 comments on commit 93ae50d

Please sign in to comment.