Skip to content

Commit 89f3517

Browse files
authored
fix(fs): clear cache after directory rename to ensure consistency (#1193)
Clear cache after renaming the directory.
1 parent 8188fb2 commit 89f3517

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/op/fs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,18 @@ func Rename(ctx context.Context, storage driver.Driver, srcPath, dstName string,
486486
updateCacheObj(storage, srcDirPath, srcRawObj, model.WrapObjName(newObj))
487487
} else if !utils.IsBool(lazyCache...) {
488488
DeleteCache(storage, srcDirPath)
489+
if srcRawObj.IsDir() {
490+
ClearCache(storage, srcPath)
491+
}
489492
}
490493
}
491494
case driver.Rename:
492495
err = s.Rename(ctx, srcObj, dstName)
493496
if err == nil && !utils.IsBool(lazyCache...) {
494497
DeleteCache(storage, srcDirPath)
498+
if srcRawObj.IsDir() {
499+
ClearCache(storage, srcPath)
500+
}
495501
}
496502
default:
497503
return errs.NotImplement

0 commit comments

Comments
 (0)