From 1773717a4745c0a18e239636db073e2f5a5490f9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 10 Apr 2021 09:29:21 +0100 Subject: [PATCH] fs/march: improve errors when root source/destination doesn't exist See: https://forum.rclone.org/t/rclone-attempts-to-read-files-in-the-destination-directory-when-the-source-doesnt-exist/23412 --- fs/march/march.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/march/march.go b/fs/march/march.go index 715f5e299..1f694a36e 100644 --- a/fs/march/march.go +++ b/fs/march/march.go @@ -404,14 +404,22 @@ func (m *March) processJob(job listDirJob) ([]listDirJob, error) { // Wait for listings to complete and report errors wg.Wait() if srcListErr != nil { - fs.Errorf(job.srcRemote, "error reading source directory: %v", srcListErr) + if job.srcRemote != "" { + fs.Errorf(job.srcRemote, "error reading source directory: %v", srcListErr) + } else { + fs.Errorf(m.Fsrc, "error reading source root directory: %v", srcListErr) + } srcListErr = fs.CountError(srcListErr) return nil, srcListErr } if dstListErr == fs.ErrorDirNotFound { // Copy the stuff anyway } else if dstListErr != nil { - fs.Errorf(job.dstRemote, "error reading destination directory: %v", dstListErr) + if job.dstRemote != "" { + fs.Errorf(job.dstRemote, "error reading destination directory: %v", dstListErr) + } else { + fs.Errorf(m.Fdst, "error reading destination root directory: %v", dstListErr) + } dstListErr = fs.CountError(dstListErr) return nil, dstListErr }