🎨 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
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

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,