dropbox: fix used space on dropbox team accounts

Before this change we were not using the used space from the team
stats.

This patch uses that as the used space if available as it seems to
include the user stats in it.

See: https://forum.rclone.org/t/rclone-about-with-dropbox-reporte-size-incorrectly/43269/
This commit is contained in:
Nick Craig-Wood 2023-12-08 11:47:20 +00:00
parent ef0f3020e4
commit f45cee831f

View File

@ -1231,18 +1231,21 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {
return nil, err return nil, err
} }
var total uint64 var total uint64
var used = q.Used
if q.Allocation != nil { if q.Allocation != nil {
if q.Allocation.Individual != nil { if q.Allocation.Individual != nil {
total += q.Allocation.Individual.Allocated total += q.Allocation.Individual.Allocated
} }
if q.Allocation.Team != nil { if q.Allocation.Team != nil {
total += q.Allocation.Team.Allocated total += q.Allocation.Team.Allocated
// Override used with Team.Used as this includes q.Used already
used = q.Allocation.Team.Used
} }
} }
usage = &fs.Usage{ usage = &fs.Usage{
Total: fs.NewUsageValue(int64(total)), // quota of bytes that can be used Total: fs.NewUsageValue(int64(total)), // quota of bytes that can be used
Used: fs.NewUsageValue(int64(q.Used)), // bytes in use Used: fs.NewUsageValue(int64(used)), // bytes in use
Free: fs.NewUsageValue(int64(total - q.Used)), // bytes which can be uploaded before reaching the quota Free: fs.NewUsageValue(int64(total - used)), // bytes which can be uploaded before reaching the quota
} }
return usage, nil return usage, nil
} }