acd: fix panic when renaming files - fixes #973

Fixed by no longer overwriting the parameters in a retry loop
This commit is contained in:
Nick Craig-Wood 2017-01-14 09:50:45 +00:00
parent 45862f4c16
commit aa62e93094

View file

@ -1007,25 +1007,23 @@ func (o *Object) Remove() error {
} }
// Restore a node // 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 resp *http.Response
var err error
err = f.pacer.Call(func() (bool, error) { err = f.pacer.Call(func() (bool, error) {
info, resp, err = info.Restore() newInfo, resp, err = info.Restore()
return f.shouldRetry(resp, err) return f.shouldRetry(resp, err)
}) })
return info, err return newInfo, err
} }
// Changes name of given node // 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 resp *http.Response
var err error
err = f.pacer.Call(func() (bool, 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 f.shouldRetry(resp, err)
}) })
return info, err return newInfo, err
} }
// Replaces one parent with another, effectively moving the file. Leaves other // Replaces one parent with another, effectively moving the file. Leaves other