Skip to content

Commit 40d3392

Browse files
fix: 解决 cloudreve 升级数据丢失的问题 (#1822)
1 parent b831472 commit 40d3392

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

backend/app/service/app_utils.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,10 @@ func upgradeInstall(installId uint, detailId uint, backup bool) error {
271271
detailDir = path.Join(constant.ResourceDir, "apps", "local", strings.TrimPrefix(install.App.Key, "local"), detail.Version)
272272
}
273273

274-
cmd := exec.Command("/bin/bash", "-c", fmt.Sprintf("cp -rf %s/* %s", detailDir, install.GetPath()))
275-
stdout, err := cmd.CombinedOutput()
276-
if err != nil {
277-
if stdout != nil {
278-
upErr = errors.New(string(stdout))
279-
return
280-
}
281-
upErr = err
282-
return
274+
cmd := exec.Command("/bin/bash", "-c", fmt.Sprintf("cp -rn %s/* %s || true", detailDir, install.GetPath()))
275+
stdout, _ := cmd.CombinedOutput()
276+
if stdout != nil {
277+
global.LOG.Errorf("upgrade app [%s] [%s] cp file log : %s ", install.App.Key, install.Name, string(stdout))
283278
}
284279

285280
composeMap := make(map[string]interface{})

0 commit comments

Comments
 (0)