🐛 Uninstalling plugins, widgets and templates may cause data sync errors https://github.com/siyuan-note/siyuan/issues/10324

This commit is contained in:
Daniel 2024-02-06 14:23:17 +08:00
parent fe9e261feb
commit 745c9bcf99
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
7 changed files with 14 additions and 12 deletions

View file

@ -27,6 +27,7 @@ import (
"github.com/dustin/go-humanize"
ants "github.com/panjf2000/ants/v2"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
@ -214,7 +215,7 @@ func InstallPlugin(repoURL, repoHash, installPath string, systemID string) error
}
func UninstallPlugin(installPath string) error {
if err := os.RemoveAll(installPath); nil != err {
if err := filelock.Remove(installPath); nil != err {
logging.LogErrorf("remove plugin [%s] failed: %s", installPath, err)
return errors.New("remove community plugin failed")
}

View file

@ -27,6 +27,7 @@ import (
"github.com/dustin/go-humanize"
"github.com/panjf2000/ants/v2"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
@ -176,7 +177,7 @@ func InstallTemplate(repoURL, repoHash, installPath string, systemID string) err
}
func UninstallTemplate(installPath string) error {
if err := os.RemoveAll(installPath); nil != err {
if err := filelock.Remove(installPath); nil != err {
logging.LogErrorf("remove template [%s] failed: %s", installPath, err)
return errors.New("remove community template failed")
}

View file

@ -26,6 +26,7 @@ import (
"github.com/dustin/go-humanize"
ants "github.com/panjf2000/ants/v2"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
@ -174,7 +175,7 @@ func InstallWidget(repoURL, repoHash, installPath string, systemID string) error
}
func UninstallWidget(installPath string) error {
if err := os.RemoveAll(installPath); nil != err {
if err := filelock.Remove(installPath); nil != err {
logging.LogErrorf("remove widget [%s] failed: %s", installPath, err)
return errors.New("remove community widget failed")
}