mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
sftpfs: fix stat info
This commit is contained in:
parent
2b9ba1d520
commit
0caeb68680
1 changed files with 18 additions and 3 deletions
|
@ -147,7 +147,11 @@ func (fs *SFTPFs) Stat(name string) (os.FileInfo, error) {
|
|||
if err := fs.checkConnection(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fs.sftpClient.Stat(name)
|
||||
info, err := fs.sftpClient.Stat(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewFileInfo(info.Name(), info.IsDir(), info.Size(), info.ModTime(), false), nil
|
||||
}
|
||||
|
||||
// Lstat returns a FileInfo describing the named file
|
||||
|
@ -155,7 +159,11 @@ func (fs *SFTPFs) Lstat(name string) (os.FileInfo, error) {
|
|||
if err := fs.checkConnection(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fs.sftpClient.Lstat(name)
|
||||
info, err := fs.sftpClient.Lstat(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewFileInfo(info.Name(), info.IsDir(), info.Size(), info.ModTime(), false), nil
|
||||
}
|
||||
|
||||
// Open opens the named file for reading
|
||||
|
@ -260,7 +268,14 @@ func (fs *SFTPFs) ReadDir(dirname string) ([]os.FileInfo, error) {
|
|||
if err := fs.checkConnection(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fs.sftpClient.ReadDir(dirname)
|
||||
entries, err := fs.sftpClient.ReadDir(dirname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for idx, entry := range entries {
|
||||
entries[idx] = NewFileInfo(entry.Name(), entry.IsDir(), entry.Size(), entry.ModTime(), false)
|
||||
}
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// IsUploadResumeSupported returns true if upload resume is supported.
|
||||
|
|
Loading…
Reference in a new issue