"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: retry propfind on 425 status
Jörn Friedrich Dreyer839eef0db269
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.goindex f26f40e65..cef1cd701 100644--- a/backend/webdav/api/types.go+++ b/backend/webdav/api/types.go@@ -82,22 +82,37 @@ type Prop struct {// Parse a status of the form "HTTP/1.1 200 OK" or "HTTP/1.1 200"var parseStatus = regexp.MustCompile(`^HTTP/[0-9.]+\s+(\d+)`)-// StatusOK examines the Status and returns an OK flag-func (p *Prop) StatusOK() bool {- // Assume OK if no statuses received+// Code extracts the status code from the first status+func (p *Prop) Code() int {if len(p.Status) == 0 {- return true+ return -1}match := parseStatus.FindStringSubmatch(p.Status[0])if len(match) < 2 {- return false+ return 0}code, err := strconv.Atoi(match[1])if err != nil {+ return 0+ }+ return code+}++// StatusOK examines the Status and returns an OK flag+func (p *Prop) StatusOK() bool {+ // Fetch status code as int+ c := p.Code()++ // Assume OK if no statuses received+ if c == -1 {+ return true+ }+ if c == 0 {return false}- if code >= 200 && code < 300 {+ if c >= 200 && c < 300 {return true+}return false}diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.goindex b8bd670c0..3624f4a8c 100644--- a/backend/webdav/webdav.go+++ b/backend/webdav/webdav.go@@ -262,6 +262,7 @@ func (f *Fs) Features() *fs.Features {// retryErrorCodes is a slice of error codes that we will retryvar retryErrorCodes = []int{423, // Locked+ 425, // Too Early429, // Too Many Requests.500, // Internal Server Error502, // Bad Gateway@@ -373,7 +374,8 @@ func (f *Fs) readMetaDataForPath(ctx context.Context, path string, depth string)return nil, fs.ErrorObjectNotFound}item := result.Responses[0]- if !item.Props.StatusOK() {+ // status code 425 is accepted here as well+ if !(item.Props.StatusOK() || item.Props.Code() == 425) {return nil, fs.ErrorObjectNotFound}if itemIsDir(&item) {