mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
fix (#187): handle simlinks
This commit is contained in:
@@ -37,6 +37,9 @@ func (f File) Size() int64 {
|
||||
return f.FSize
|
||||
}
|
||||
func (f File) Mode() os.FileMode {
|
||||
if f.IsDir() {
|
||||
return os.ModeDir
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func (f File) ModTime() time.Time {
|
||||
|
||||
@@ -69,12 +69,12 @@ func FileLs(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
Name: name,
|
||||
Size: entries[i].Size(),
|
||||
Time: modTime,
|
||||
Type: func(isDir bool) string {
|
||||
if isDir == true {
|
||||
return "directory"
|
||||
Type: func(mode os.FileMode) string {
|
||||
if mode.IsRegular() {
|
||||
return "file"
|
||||
}
|
||||
return "file"
|
||||
}(entries[i].IsDir()),
|
||||
return "directory"
|
||||
}(entries[i].Mode()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user