改进重命名资源文件性能 Fix https://github.com/siyuan-note/siyuan/issues/7322

This commit is contained in:
Liang Ding 2023-02-10 12:05:56 +08:00
parent 929a25a783
commit 6743b21193
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 5 deletions

View file

@ -42,6 +42,12 @@ func LoadTree(boxID, p string, luteEngine *lute.Lute) (ret *parse.Tree, err erro
if nil != err {
return
}
ret, err = LoadTreeByData(data, boxID, p, luteEngine)
return
}
func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *parse.Tree, err error) {
ret = parseJSON2Tree(boxID, p, data, luteEngine)
if nil == ret {
return nil, errors.New("parse tree failed")
@ -88,7 +94,7 @@ func LoadTree(boxID, p string, luteEngine *lute.Lute) (ret *parse.Tree, err erro
ial := ReadDocIAL(parentData)
if 1 > len(ial) {
logging.LogWarnf("tree [%s] is corrupted", filePath)
logging.LogWarnf("tree [%s] is corrupted", filepath.Join(boxID, p))
}
title := ial["title"]
if "" == title {