fix: bypass errors on symbolic links
parent
22327703fd
commit
df453ca634
9
file.go
9
file.go
|
@ -134,14 +134,13 @@ func (i *File) GetListing(u *User, r *http.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(f.Mode().String(), "L") {
|
if strings.HasPrefix(f.Mode().String(), "L") {
|
||||||
// It's a symbolic link
|
// It's a symbolic link. We try to follow it. If it doesn't work,
|
||||||
// The FileInfo from Readdir treats symbolic link as a file only.
|
// we stay with the link information instead if the target's.
|
||||||
info, err := os.Stat(f.Name())
|
info, err := os.Stat(f.Name())
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
f = info
|
f = info
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
name += "/"
|
name += "/"
|
||||||
|
|
Loading…
Reference in New Issue