From 951de73d893638899c8e3a374ab6e4e835b711a8 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Jan 2024 23:48:06 +0800 Subject: [PATCH] :art: Support manual purge of unreferenced data snapshots in the S3/WebDAV cloud storage https://github.com/siyuan-note/siyuan/issues/10081 --- repo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repo.go b/repo.go index d101bef..864b769 100644 --- a/repo.go +++ b/repo.go @@ -287,7 +287,7 @@ func (repo *Repo) PurgeCloud() (ret *entity.PurgeStat, err error) { return } - err = repo.purgeIndexesV2(unreferencedIndexIDs) + err = repo.purgeIndexesV2(refIndexIDs) if nil != err { logging.LogErrorf("purge indexes-v2.json failed: %s", err) return @@ -309,7 +309,7 @@ func (repo *Repo) PurgeCloud() (ret *entity.PurgeStat, err error) { return } -func (repo *Repo) purgeIndexesV2(unreferencedIndexIDs map[string]bool) (err error) { +func (repo *Repo) purgeIndexesV2(refIndexIDs map[string]bool) (err error) { data, err := repo.cloud.DownloadObject("indexes-v2.json") if nil != err { if !errors.Is(err, cloud.ErrCloudObjectNotFound) { @@ -333,7 +333,7 @@ func (repo *Repo) purgeIndexesV2(unreferencedIndexIDs map[string]bool) (err erro var tmp []*cloud.Index for _, index := range indexes.Indexes { - if !unreferencedIndexIDs[index.ID] { + if refIndexIDs[index.ID] { tmp = append(tmp, index) } }