1
mirror of https://github.com/rclone/rclone synced 2024-10-02 08:40:31 +02:00

webdav: fix About/df when reading the available/total returns 0

Some WebDAV servers return an empty Available and Used which parses as 0.

This caused About to return the Total as 0 which can confused mounted
file systems.

After this change we ignore the result if Available and Used are both 0.

See: https://forum.rclone.org/t/windows-mounted-webdav-drive-has-no-free-space/8938
This commit is contained in:
Nick Craig-Wood 2019-03-14 21:19:47 +00:00
parent 2b58d1a46f
commit 2fbb504b66

View File

@ -916,11 +916,13 @@ func (f *Fs) About() (*fs.Usage, error) {
return nil, errors.Wrap(err, "about call failed") return nil, errors.Wrap(err, "about call failed")
} }
usage := &fs.Usage{} usage := &fs.Usage{}
if q.Available >= 0 && q.Used >= 0 { if q.Available != 0 || q.Used != 0 {
usage.Total = fs.NewUsageValue(q.Available + q.Used) if q.Available >= 0 && q.Used >= 0 {
} usage.Total = fs.NewUsageValue(q.Available + q.Used)
if q.Used >= 0 { }
usage.Used = fs.NewUsageValue(q.Used) if q.Used >= 0 {
usage.Used = fs.NewUsageValue(q.Used)
}
} }
return usage, nil return usage, nil
} }