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

This commit is contained in:
Daniel
2023-08-27 10:53:48 +08:00
parent f4e840fae6
commit 4baeeed1ec

View File

@@ -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,