Skip to content

Commit df453ca

Browse files
committed
fix: bypass errors on symbolic links
1 parent 2232770 commit df453ca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

file.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,12 @@ func (i *File) GetListing(u *User, r *http.Request) error {
134134
}
135135

136136
if strings.HasPrefix(f.Mode().String(), "L") {
137-
// It's a symbolic link
138-
// The FileInfo from Readdir treats symbolic link as a file only.
137+
// It's a symbolic link. We try to follow it. If it doesn't work,
138+
// we stay with the link information instead if the target's.
139139
info, err := os.Stat(f.Name())
140-
if err != nil {
141-
return err
140+
if err == nil {
141+
f = info
142142
}
143-
f = info
144143
}
145144

146145
if f.IsDir() {

0 commit comments

Comments
 (0)