fix symbolic links issue on Linux. (#281)

This commit is contained in:
OopsMonk 2017-11-14 15:21:26 +08:00 committed by Henrique Dias
parent 6f39464130
commit d269e239bf

10
file.go
View File

@ -133,6 +133,16 @@ func (i *File) GetListing(u *User, r *http.Request) error {
continue continue
} }
if strings.HasPrefix(f.Mode().String(), "L") {
// It's a symbolic link
// The FileInfo from Readdir treats symbolic link as a file only.
info, err := os.Stat(f.Name())
if err != nil {
return err
}
f = info
}
if f.IsDir() { if f.IsDir() {
name += "/" name += "/"
dirCount++ dirCount++