🎨 PDF files longer than 1024 pages are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9053

This commit is contained in:
Daniel 2023-08-27 11:02:36 +08:00
parent 4baeeed1ec
commit fd32668abc
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -519,6 +519,7 @@ func (parser *TxtAssetParser) Parse(absPath string) (ret *AssetParseResult) {
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
logging.LogWarnf("asset [%s] is not UTF-8 encoded", absPath)
return
}
@ -808,6 +809,12 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
}
instance.Close()
if 1024 < pc.PageCount {
// PDF files longer than 1024 pages are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9053
logging.LogWarnf("ignore large PDF asset [%s] with [%d] pages", absPath, pc.PageCount)
return
}
// next setup worker pool for processing PDF pages
pages := make(chan *pdfPage, pc.PageCount)
results := make(chan *pdfTextResult, pc.PageCount)