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

onedrive: fix overwrite detection in Copy - fixes #1224

Nick Craig-Woodf046c00d3b62
diff --git a/onedrive/onedrive.go b/onedrive/onedrive.go
index 10d1c1f8c..0df3e71a9 100644
--- a/onedrive/onedrive.go
+++ b/onedrive/onedrive.go
@@ -600,8 +600,10 @@ func (f *Fs) Copy(src fs.Object, remote string) (fs.Object, error) {
return nil, err
}
- if strings.ToLower(srcObj.remote) == strings.ToLower(remote) {
- return nil, errors.Errorf("can't copy %q -> %q as are same name when lowercase", srcObj.remote, remote)
+ srcPath := srcObj.fs.rootSlash() + srcObj.remote
+ dstPath := f.rootSlash() + remote
+ if strings.ToLower(srcPath) == strings.ToLower(dstPath) {
+ return nil, errors.Errorf("can't copy %q -> %q as are same name when lowercase", srcPath, dstPath)
}
// Create temporary object