mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-20 04:36:09 +08:00
fix(fs): clear cache after directory rename to ensure consistency (#1193)
Clear cache after renaming the directory.
This commit is contained in:
@ -486,12 +486,18 @@ func Rename(ctx context.Context, storage driver.Driver, srcPath, dstName string,
|
|||||||
updateCacheObj(storage, srcDirPath, srcRawObj, model.WrapObjName(newObj))
|
updateCacheObj(storage, srcDirPath, srcRawObj, model.WrapObjName(newObj))
|
||||||
} else if !utils.IsBool(lazyCache...) {
|
} else if !utils.IsBool(lazyCache...) {
|
||||||
DeleteCache(storage, srcDirPath)
|
DeleteCache(storage, srcDirPath)
|
||||||
|
if srcRawObj.IsDir() {
|
||||||
|
ClearCache(storage, srcPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case driver.Rename:
|
case driver.Rename:
|
||||||
err = s.Rename(ctx, srcObj, dstName)
|
err = s.Rename(ctx, srcObj, dstName)
|
||||||
if err == nil && !utils.IsBool(lazyCache...) {
|
if err == nil && !utils.IsBool(lazyCache...) {
|
||||||
DeleteCache(storage, srcDirPath)
|
DeleteCache(storage, srcDirPath)
|
||||||
|
if srcRawObj.IsDir() {
|
||||||
|
ClearCache(storage, srcPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return errs.NotImplement
|
return errs.NotImplement
|
||||||
|
Reference in New Issue
Block a user