Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Non-UTF-8 encoded text files are not included in asset file content searching Fix https://github.com/siyuan-note/siyuan/issues/9052

Daniel4baeeed1ecb7
diff --git a/kernel/model/asset_content.go b/kernel/model/asset_content.go
index 2ba193b8ea..c5ac3c7d9e 100644
--- a/kernel/model/asset_content.go
+++ b/kernel/model/asset_content.go
@@ -26,6 +26,7 @@ import (
"strings"
"sync"
"time"
+ "unicode/utf8"
"code.sajari.com/docconv"
"github.com/88250/gulu"
@@ -516,6 +517,11 @@ func (parser *TxtAssetParser) Parse(absPath string) (ret *AssetParseResult) {
return
}
+ if !utf8.Valid(data) {
+ // Non-UTF-8 encoded text files are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9052
+ return
+ }
+
content := string(data)
ret = &AssetParseResult{
Content: content,