fs: Fix nil pointer on copy & move operations directly to remote

Fix the copy and move operations that broke in 127f0fc when copying directly
to a remote without a specific destination.

Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
This commit is contained in:
Anagh Kumar Baranwal 2020-11-09 18:06:10 +05:30 committed by GitHub
parent 43e0929339
commit 30c8b1b84f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -511,7 +511,7 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj
return newDst, err
}
}
if src.String() != newDst.String() {
if newDst != nil && src.String() != newDst.String() {
fs.Infof(src, "%s to: %s", actionTaken, newDst.String())
} else {
fs.Infof(src, actionTaken)
@ -569,7 +569,7 @@ func Move(ctx context.Context, fdst fs.Fs, dst fs.Object, remote string, src fs.
newDst, err = doMove(ctx, src, remote)
switch err {
case nil:
if src.String() != newDst.String() {
if newDst != nil && src.String() != newDst.String() {
fs.Infof(src, "Moved (server-side) to: %s", newDst.String())
} else {
fs.Infof(src, "Moved (server-side)")