"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
webdav: support About - fixes #2937
Nick Craig-Woodc29406878026
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.goindex b0d2a57d5..991bcc827 100644--- a/backend/webdav/api/types.go+++ b/backend/webdav/api/types.go@@ -209,3 +209,22 @@ func (t *Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {}return err}++// Quota is used to read the bytes used and available+//+// <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">+// <d:response>+// <d:href>/remote.php/webdav/</d:href>+// <d:propstat>+// <d:prop>+// <d:quota-available-bytes>-3</d:quota-available-bytes>+// <d:quota-used-bytes>376461895</d:quota-used-bytes>+// </d:prop>+// <d:status>HTTP/1.1 200 OK</d:status>+// </d:propstat>+// </d:response>+// </d:multistatus>+type Quota struct {+ Available int64 `xml:"DAV: response>propstat>prop>quota-available-bytes"`+ Used int64 `xml:"DAV: response>propstat>prop>quota-used-bytes"`+}diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.goindex d2cd9facc..5cb257501 100644--- a/backend/webdav/webdav.go+++ b/backend/webdav/webdav.go@@ -869,6 +869,46 @@ func (f *Fs) Hashes() hash.Set {return hash.Set(hash.None)}+// About gets quota information+func (f *Fs) About() (*fs.Usage, error) {+ opts := rest.Opts{+ Method: "PROPFIND",+ Path: "",+ ExtraHeaders: map[string]string{+ "Depth": "0",+ },+ }+ opts.Body = bytes.NewBuffer([]byte(`<?xml version="1.0" ?>+<D:propfind xmlns:D="DAV:">+ <D:prop>+ <D:quota-available-bytes/>+ <D:quota-used-bytes/>+ </D:prop>+</D:propfind>+`))+ var q = api.Quota{+ Available: -1,+ Used: -1,+ }+ var resp *http.Response+ var err error+ err = f.pacer.Call(func() (bool, error) {+ resp, err = f.srv.CallXML(&opts, nil, &q)+ return shouldRetry(resp, err)+ })+ if err != nil {+ return nil, errors.Wrap(err, "about call failed")+ }+ usage := &fs.Usage{}+ 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)+ }+ return usage, nil+}+// ------------------------------------------------------------// Fs returns the parent Fs@@ -1059,5 +1099,6 @@ var (_ fs.Copier = (*Fs)(nil)_ fs.Mover = (*Fs)(nil)_ fs.DirMover = (*Fs)(nil)+ _ fs.Abouter = (*Fs)(nil)_ fs.Object = (*Object)(nil))diff --git a/docs/content/overview.md b/docs/content/overview.mdindex 20ee72c88..f6255634e 100644--- a/docs/content/overview.md+++ b/docs/content/overview.md@@ -149,7 +149,7 @@ operations more efficient.| pCloud | Yes | Yes | Yes | Yes | Yes | No | No | No [#2178](https://github.com/ncw/rclone/issues/2178) | Yes || QingStor | No | Yes | No | No | No | Yes | No | No [#2178](https://github.com/ncw/rclone/issues/2178) | No || SFTP | No | No | Yes | Yes | No | No | Yes | No [#2178](https://github.com/ncw/rclone/issues/2178) | No |-| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ‡ | No [#2178](https://github.com/ncw/rclone/issues/2178) | No |+| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ‡ | No [#2178](https://github.com/ncw/rclone/issues/2178) | Yes || Yandex Disk | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes || The local filesystem | Yes | No | Yes | Yes | No | No | Yes | No | Yes |@@ -220,5 +220,7 @@ on the particular cloud provider.This is used to fetch quota information from the remote, like bytesused/free/quota and bytes used in the trash.+This is also used to return the space used, available for `rclone mount`.+If the server can't do `About` then `rclone about` will return anerror.