🐛 索引嵌入块内容可能会导致内核崩溃 https://github.com/siyuan-note/siyuan/issues/7213

This commit is contained in:
Liang Ding 2023-02-01 09:53:40 +08:00
parent 7aea03db69
commit 70e2cd3987
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 4 deletions

View file

@ -197,6 +197,10 @@ func autoIndexEmbedBlock(embedBlocks []*sql.Block) {
for i, embedBlock := range embedBlocks {
stmt := strings.TrimPrefix(embedBlock.Markdown, "{{")
stmt = strings.TrimSuffix(stmt, "}}")
if !strings.Contains(strings.ToLower(stmt), "select") {
continue
}
queryResultBlocks := sql.SelectBlocksRawStmtNoParse(stmt, 102400)
for _, block := range queryResultBlocks {
embedBlock.Content += block.Content