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

webdav: fix Copy, Move and DirMove to be more compatible

Nick Craig-Woode612673ea0e7
diff --git a/webdav/webdav.go b/webdav/webdav.go
index 59bdc11b0..91602ac7b 100644
--- a/webdav/webdav.go
+++ b/webdav/webdav.go
@@ -638,13 +638,17 @@ func (f *Fs) copyOrMove(src fs.Object, remote string, method string) (fs.Object,
if err != nil {
return nil, errors.Wrap(err, "Copy mkParentDir failed")
}
+ destinationURL, err := rest.URLJoin(f.endpoint, dstPath)
+ if err != nil {
+ return nil, errors.Wrap(err, "copyOrMove couldn't join URL")
+ }
var resp *http.Response
opts := rest.Opts{
Method: method,
Path: srcObj.filePath(),
NoResponse: true,
ExtraHeaders: map[string]string{
- "Destination": path.Join(f.endpoint.Path, dstPath),
+ "Destination": destinationURL.String(),
"Overwrite": "F",
},
}
@@ -732,13 +736,18 @@ func (f *Fs) DirMove(src fs.Fs, srcRemote, dstRemote string) error {
return errors.Wrap(err, "DirMove mkParentDir dst failed")
}
+ destinationURL, err := rest.URLJoin(f.endpoint, dstPath)
+ if err != nil {
+ return errors.Wrap(err, "DirMove couldn't join URL")
+ }
+
var resp *http.Response
opts := rest.Opts{
Method: "MOVE",
Path: addSlash(srcPath),
NoResponse: true,
ExtraHeaders: map[string]string{
- "Destination": addSlash(path.Join(f.endpoint.Path, dstPath)),
+ "Destination": addSlash(destinationURL.String()),
"Overwrite": "F",
},
}