mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
vfs: fix failed to _ensure cache internal error: downloaders is nil error
This error was caused by renaming an open file. When the file was renamed in the cache, the downloaders were cleared, however the downloaders were not re-opened when needed again, instead this error was generated. This fix re-opens the downloaders if they have been closed by renaming the file. Fixes #5984
This commit is contained in:
parent
2339172df2
commit
ec72432cec
@ -1128,7 +1128,10 @@ func (item *Item) _ensure(offset, size int64) (err error) {
|
||||
return item.downloaders.EnsureDownloader(r)
|
||||
}
|
||||
if item.downloaders == nil {
|
||||
return errors.New("internal error: downloaders is nil")
|
||||
// Downloaders can be nil here if the file has been
|
||||
// renamed, so need to make some more downloaders
|
||||
// OK to call downloaders constructor with item.mu held
|
||||
item.downloaders = downloaders.New(item, item.c.opt, item.name, item.o)
|
||||
}
|
||||
return item.downloaders.Download(r)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user