mirror of
https://github.com/rclone/rclone.git
synced 2025-01-11 00:40:03 +01:00
cache: correctly handle fs.ErrorIsFile in GetFn - fixes #3424
This commit is contained in:
parent
873e87fc38
commit
0c1eaf1bcb
8
fs/cache/cache.go
vendored
8
fs/cache/cache.go
vendored
@ -13,15 +13,15 @@ var (
|
|||||||
// GetFn gets a fs.Fs named fsString either from the cache or creates
|
// GetFn gets a fs.Fs named fsString either from the cache or creates
|
||||||
// it afresh with the create function
|
// it afresh with the create function
|
||||||
func GetFn(fsString string, create func(fsString string) (fs.Fs, error)) (f fs.Fs, err error) {
|
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) {
|
value, err := c.Get(fsString, func(fsString string) (f interface{}, ok bool, err error) {
|
||||||
f, err := create(fsString)
|
f, err = create(fsString)
|
||||||
ok = err == nil || err == fs.ErrorIsFile
|
ok = err == nil || err == fs.ErrorIsFile
|
||||||
return f, ok, err
|
return f, ok, err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil && err != fs.ErrorIsFile {
|
||||||
return nil, err
|
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
|
// Get gets a fs.Fs named fsString either from the cache or creates it afresh
|
||||||
|
Loading…
Reference in New Issue
Block a user