This commit is contained in:
Liang Ding 2022-09-29 21:52:01 +08:00
parent 56129699b9
commit 69a9713776
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
38 changed files with 193 additions and 438 deletions

View file

@ -26,6 +26,7 @@ import (
"github.com/88250/lute/parse"
"github.com/88250/lute/render"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
@ -111,7 +112,7 @@ func html2BlockDOM(c *gin.Context) {
name = name[0 : len(name)-len(ext)]
name = name + "-" + ast.NewNodeID() + ext
targetPath := filepath.Join(util.DataDir, "assets", name)
if err = gulu.File.CopyFile(localPath, targetPath); nil != err {
if err = filelock.Copy(localPath, targetPath); nil != err {
logging.LogErrorf("copy asset from [%s] to [%s] failed: %s", localPath, targetPath, err)
return ast.WalkStop
}