fix: bypass errors on symbolic links
Former-commit-id: 20cd8429be62bbe7c4f2ee48f7dddc2f389d5117 [formerly f857fe8d323a25e00e193f959aac605d742d7f15] [formerly 2c4ef521c756b902b7914a42958c163db85c2cc3 [formerly df453ca634
]]
Former-commit-id: a638071b19674d82400639a142cb32085c20d1d9 [formerly aaabe20901f149ec00f4eea1ac730a6cf9f30856]
Former-commit-id: 43a13d56401f6b18fee8cff4806f960cd5683314
pull/726/head
parent
071e1ec19b
commit
da05c5048e
9
file.go
9
file.go
|
@ -134,13 +134,12 @@ func (i *File) GetListing(u *User, r *http.Request) error {
|
|||
}
|
||||
|
||||
if strings.HasPrefix(f.Mode().String(), "L") {
|
||||
// It's a symbolic link
|
||||
// The FileInfo from Readdir treats symbolic link as a file only.
|
||||
// It's a symbolic link. We try to follow it. If it doesn't work,
|
||||
// we stay with the link information instead if the target's.
|
||||
info, err := os.Stat(f.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
if err == nil {
|
||||
f = info
|
||||
}
|
||||
f = info
|
||||
}
|
||||
|
||||
if f.IsDir() {
|
||||
|
|
Loading…
Reference in New Issue