mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-15 21:04:46 +01:00
fix (#187): handle simlinks
This commit is contained in:
parent
995d6c11f0
commit
4814175f00
2 changed files with 8 additions and 5 deletions
|
|
@ -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()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue