From aa62e93094c5206f09af619e85022bfedede5d54 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 14 Jan 2017 09:50:45 +0000 Subject: [PATCH] acd: fix panic when renaming files - fixes #973 Fixed by no longer overwriting the parameters in a retry loop --- amazonclouddrive/amazonclouddrive.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.go index 131f328db..26e4ac4aa 100644 --- a/amazonclouddrive/amazonclouddrive.go +++ b/amazonclouddrive/amazonclouddrive.go @@ -1007,25 +1007,23 @@ func (o *Object) Remove() error { } // Restore a node -func (f *Fs) restoreNode(info *acd.Node) (*acd.Node, error) { +func (f *Fs) restoreNode(info *acd.Node) (newInfo *acd.Node, err error) { var resp *http.Response - var err error err = f.pacer.Call(func() (bool, error) { - info, resp, err = info.Restore() + newInfo, resp, err = info.Restore() return f.shouldRetry(resp, err) }) - return info, err + return newInfo, err } // Changes name of given node -func (f *Fs) renameNode(info *acd.Node, newName string) (*acd.Node, error) { +func (f *Fs) renameNode(info *acd.Node, newName string) (newInfo *acd.Node, err error) { var resp *http.Response - var err error err = f.pacer.Call(func() (bool, error) { - info, resp, err = info.Rename(newName) + newInfo, resp, err = info.Rename(newName) return f.shouldRetry(resp, err) }) - return info, err + return newInfo, err } // Replaces one parent with another, effectively moving the file. Leaves other