mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
sftpd: add statvfs@openssh.com support
This commit is contained in:
@@ -503,6 +503,17 @@ func (fs *SFTPFs) GetMimeType(name string) (string, error) {
|
||||
return ctype, err
|
||||
}
|
||||
|
||||
// GetAvailableDiskSize return the available size for the specified path
|
||||
func (fs *SFTPFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error) {
|
||||
if err := fs.checkConnection(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, ok := fs.sftpClient.HasExtension("statvfs@openssh.com"); !ok {
|
||||
return nil, ErrStorageSizeUnavailable
|
||||
}
|
||||
return fs.sftpClient.StatVFS(dirName)
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
func (fs *SFTPFs) Close() error {
|
||||
fs.Lock()
|
||||
@@ -521,11 +532,6 @@ func (fs *SFTPFs) Close() error {
|
||||
return sshErr
|
||||
}
|
||||
|
||||
// GetAvailableDiskSize return the available size for the specified path
|
||||
func (*SFTPFs) GetAvailableDiskSize(dirName string) (int64, error) {
|
||||
return 0, errStorageSizeUnavailable
|
||||
}
|
||||
|
||||
func (fs *SFTPFs) checkConnection() error {
|
||||
err := fs.closed()
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user