diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go index 89f207327..44bdc7e27 100644 --- a/backend/webdav/api/types.go +++ b/backend/webdav/api/types.go @@ -226,6 +226,6 @@ func (t *Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { // // type Quota struct { - Available int64 `xml:"DAV: response>propstat>prop>quota-available-bytes"` - Used int64 `xml:"DAV: response>propstat>prop>quota-used-bytes"` + Available string `xml:"DAV: response>propstat>prop>quota-available-bytes"` + Used string `xml:"DAV: response>propstat>prop>quota-used-bytes"` } diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go index 3302df53a..f6f4d58bd 100644 --- a/backend/webdav/webdav.go +++ b/backend/webdav/webdav.go @@ -17,6 +17,7 @@ import ( "net/url" "os/exec" "path" + "strconv" "strings" "time" @@ -975,10 +976,7 @@ func (f *Fs) About(ctx context.Context) (*fs.Usage, error) { `)) - var q = api.Quota{ - Available: -1, - Used: -1, - } + var q api.Quota var resp *http.Response var err error err = f.pacer.Call(func() (bool, error) { @@ -989,14 +987,14 @@ func (f *Fs) About(ctx context.Context) (*fs.Usage, error) { return nil, errors.Wrap(err, "about call failed") } usage := &fs.Usage{} - if q.Used >= 0 { - usage.Used = fs.NewUsageValue(q.Used) + if i, err := strconv.ParseInt(q.Used, 10, 64); err == nil && i >= 0 { + usage.Used = fs.NewUsageValue(i) } - if q.Available >= 0 { - usage.Free = fs.NewUsageValue(q.Available) + if i, err := strconv.ParseInt(q.Available, 10, 64); err == nil && i >= 0 { + usage.Free = fs.NewUsageValue(i) } - if q.Available >= 0 && q.Used >= 0 { - usage.Total = fs.NewUsageValue(q.Available + q.Used) + if usage.Used != nil && usage.Free != nil { + usage.Total = fs.NewUsageValue(*usage.Used + *usage.Free) } return usage, nil }