Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: fix failed to _ensure cache internal error: downloaders is nil error

Nick Craig-Woodec72432cecdc
diff --git a/vfs/vfscache/item.go b/vfs/vfscache/item.go
index 6e06bcd51..d2dc5d295 100644
--- a/vfs/vfscache/item.go
+++ b/vfs/vfscache/item.go
@@ -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)
}