🎨 Update av export

This commit is contained in:
Daniel 2023-09-25 22:13:09 +08:00
parent 4dd1a97262
commit 82c946ab4d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1358,6 +1358,7 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
} }
// 导出数据库 Attribute View export https://github.com/siyuan-note/siyuan/issues/8710 // 导出数据库 Attribute View export https://github.com/siyuan-note/siyuan/issues/8710
exportStorageAvDir := filepath.Join(exportFolder, "storage", "av")
for _, tree := range trees { for _, tree := range trees {
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering { if !entering {
@ -1369,10 +1370,14 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
} }
avID := n.AttributeViewID avID := n.AttributeViewID
if avJSONPath := av.GetAttributeViewDataPath(avID); !gulu.File.IsExist(avJSONPath) { avJSONPath := av.GetAttributeViewDataPath(avID)
if !gulu.File.IsExist(avJSONPath) {
return ast.WalkContinue return ast.WalkContinue
} }
if copyErr := filelock.Copy(avJSONPath, filepath.Join(exportStorageAvDir, avID+".json")); nil != copyErr {
logging.LogErrorf("copy av json failed: %s", copyErr)
}
return ast.WalkContinue return ast.WalkContinue
}) })