File 8122.patch of Package rclone
From 3941e9d3290b806df854f38ce683f8692e1386e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= <jfd@butonic.de>
Date: Wed, 9 Oct 2024 18:48:10 +0200
Subject: [PATCH 1/3] webdav backend: retry propfind on 425 status
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
---
backend/webdav/webdav.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index f3e2ee9057385..eed6f79ad49d2 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -244,6 +244,7 @@ func (f *Fs) Features() *fs.Features {
// retryErrorCodes is a slice of error codes that we will retry
var retryErrorCodes = []int{
423, // Locked
+ 425, // Too Early
429, // Too Many Requests.
500, // Internal Server Error
502, // Bad Gateway
From f1b4188b600964805639078b3c879a5fc293aeee Mon Sep 17 00:00:00 2001
From: Klaas Freitag <kraft@freisturz.de>
Date: Mon, 14 Oct 2024 16:36:10 +0200
Subject: [PATCH 2/3] Allow 425 as a valid state, it means the file is still in
postprocessing
in ownCloud Infinite Scale, files might be in that state if
postprocessing is still ongoing. All metadata are available anyway
---
backend/webdav/api/types.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go
index f26f40e654402..6f2657b122c88 100644
--- a/backend/webdav/api/types.go
+++ b/backend/webdav/api/types.go
@@ -96,6 +96,10 @@ func (p *Prop) StatusOK() bool {
if err != nil {
return false
}
+ // allow status 425 "too early" for files still in postprocessing
+ if code == 425 {
+ return true
+ }
if code >= 200 && code < 300 {
return true
}
From e1ea2fa6b8997625062c318e70d2bc3244b5c7f5 Mon Sep 17 00:00:00 2001
From: Klaas Freitag <kraft@freisturz.de>
Date: Thu, 17 Oct 2024 15:19:06 +0200
Subject: [PATCH 3/3] Allow item status 425 "too early" for items when changing
metadata
Fixes the upload behavior with ownCloud Infinite Scale
---
backend/webdav/api/types.go | 29 ++++++++++++++++++++---------
backend/webdav/webdav.go | 3 ++-
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go
index 6f2657b122c88..cef1cd701cada 100644
--- a/backend/webdav/api/types.go
+++ b/backend/webdav/api/types.go
@@ -82,26 +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 false
+ return 0
}
- // allow status 425 "too early" for files still in postprocessing
- if code == 425 {
+ 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 code >= 200 && code < 300 {
+ if c == 0 {
+ return false
+ }
+ if c >= 200 && c < 300 {
return true
+
}
return false
}
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index eed6f79ad49d2..c33718de50ca9 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -356,7 +356,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) {