From fc8b13c9937316f19e0727d125b2ff4fccf131da Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 12 Oct 2017 20:45:36 +0100 Subject: [PATCH] moveto/copyto: Fix to allow copying to the same name - fixes #1736 --- fs/operations.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/operations.go b/fs/operations.go index 13cc983b6..cc8d4342e 100644 --- a/fs/operations.go +++ b/fs/operations.go @@ -1716,7 +1716,9 @@ func Rmdirs(f Fs, dir string) error { // moveOrCopyFile moves or copies a single file possibly to a new name func moveOrCopyFile(fdst Fs, fsrc Fs, dstFileName string, srcFileName string, cp bool) (err error) { - if fdst.Name() == fsrc.Name() && dstFileName == srcFileName { + dstFilePath := path.Join(fdst.Root(), dstFileName) + srcFilePath := path.Join(fsrc.Root(), srcFileName) + if fdst.Name() == fsrc.Name() && dstFilePath == srcFilePath { Debugf(fdst, "don't need to copy/move %s, it is already at target location", dstFileName) return nil }