From 861e125a4ff37b3c7fab7a3d91e3f2623fafd45c Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Fri, 4 Aug 2017 23:16:29 +0200 Subject: [PATCH] =?UTF-8?q?local:=20revert=20to=20copy=20when=20moving=20f?= =?UTF-8?q?ile=20across=20file=20system=20boundaries=20=E2=80=93=20fixes?= =?UTF-8?q?=20#1176?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/local.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/local/local.go b/local/local.go index d8b71bfc7..965079673 100644 --- a/local/local.go +++ b/local/local.go @@ -472,8 +472,16 @@ func (f *Fs) Move(src fs.Object, remote string) (fs.Object, error) { // Do the move err = os.Rename(srcObj.path, dstObj.path) - if err != nil { + if os.IsNotExist(err) { + // race condition, source was deleted in the meantime return nil, err + } else if os.IsPermission(err) { + // not enough rights to write to dst + return nil, err + } else if err != nil { + // not quite clear, but probably trying to move a file across file system + // boundaries. Copying might still work. + return nil, fs.ErrorCantMove } // Update the info