From 935416de45f556748ca00599830262cb1ad68bb3 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Fri, 24 Jun 2022 14:24:39 +0800 Subject: [PATCH] chore: clear parent folder cache after upload --- internal/operations/fs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/operations/fs.go b/internal/operations/fs.go index e687e84bfde..39a291b6805 100644 --- a/internal/operations/fs.go +++ b/internal/operations/fs.go @@ -214,5 +214,11 @@ func Put(ctx context.Context, account driver.Driver, dstDirPath string, file mod if up == nil { up = func(p int) {} } - return account.Put(ctx, parentDir, file, up) + err = account.Put(ctx, parentDir, file, up) + if err == nil { + // clear cache + key := stdpath.Join(account.GetAccount().VirtualPath, dstDirPath) + filesCache.Del(key) + } + return err }