Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

pcloud: fix about with no free space left

buengese74bd7f3381ed
diff --git a/backend/pcloud/pcloud.go b/backend/pcloud/pcloud.go
index 82f9f42f5..cb470599c 100644
--- a/backend/pcloud/pcloud.go
+++ b/backend/pcloud/pcloud.go
@@ -908,10 +908,14 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {
if err != nil {
return nil, err
}
+ free := q.Quota - q.UsedQuota
+ if free < 0 {
+ free = 0
+ }
usage = &fs.Usage{
- Total: fs.NewUsageValue(q.Quota), // quota of bytes that can be used
- Used: fs.NewUsageValue(q.UsedQuota), // bytes in use
- Free: fs.NewUsageValue(q.Quota - q.UsedQuota), // bytes which can be uploaded before reaching the quota
+ Total: fs.NewUsageValue(q.Quota), // quota of bytes that can be used
+ Used: fs.NewUsageValue(q.UsedQuota), // bytes in use
+ Free: fs.NewUsageValue(free), // bytes which can be uploaded before reaching the quota
}
return usage, nil
}