From f046c00d3b620dd2ac0b11bc5e28356d050e2a56 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 11 Mar 2017 22:22:13 +0000 Subject: [PATCH] onedrive: fix overwrite detection in Copy - fixes #1224 --- onedrive/onedrive.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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