From da05c5048eda40b1ab34545be88d3e00f8bcdfeb Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 18 Feb 2018 09:49:40 +0000 Subject: [PATCH] fix: bypass errors on symbolic links Former-commit-id: 20cd8429be62bbe7c4f2ee48f7dddc2f389d5117 [formerly f857fe8d323a25e00e193f959aac605d742d7f15] [formerly 2c4ef521c756b902b7914a42958c163db85c2cc3 [formerly df453ca6349166af3bc3c3a65e9d176e30605319]] Former-commit-id: a638071b19674d82400639a142cb32085c20d1d9 [formerly aaabe20901f149ec00f4eea1ac730a6cf9f30856] Former-commit-id: 43a13d56401f6b18fee8cff4806f960cd5683314 --- file.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/file.go b/file.go index be63c07b..7e34d1ff 100644 --- a/file.go +++ b/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() {