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

cache: correctly handle fs.ErrorIsFile in GetFn - fixes #3424

buengese0c1eaf1bcbf1
diff --git a/fs/cache/cache.go b/fs/cache/cache.go
index 549833570..1a8482bf8 100644
--- a/fs/cache/cache.go
+++ b/fs/cache/cache.go
@@ -13,15 +13,15 @@ var (
// GetFn gets a fs.Fs named fsString either from the cache or creates
// it afresh with the create function
func GetFn(fsString string, create func(fsString string) (fs.Fs, error)) (f fs.Fs, err error) {
- value, err := c.Get(fsString, func(fsString string) (value interface{}, ok bool, error error) {
- f, err := create(fsString)
+ value, err := c.Get(fsString, func(fsString string) (f interface{}, ok bool, err error) {
+ f, err = create(fsString)
ok = err == nil || err == fs.ErrorIsFile
return f, ok, err
})
- if err != nil {
+ if err != nil && err != fs.ErrorIsFile {
return nil, err
}
- return value.(fs.Fs), nil
+ return value.(fs.Fs), err
}
// Get gets a fs.Fs named fsString either from the cache or creates it afresh