🎨 PDF files larger than 64MB are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9500

This commit is contained in:
Daniel 2023-10-25 09:48:13 +08:00
parent b64dfdd224
commit 17b598b033
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -480,6 +480,7 @@ func NewAssetsSearcher() *AssetsSearcher {
const (
TxtAssetContentMaxSize = 1024 * 1024 * 4
PDFAssetContentMaxPage = 1024
PDFAssetContentMaxSize = 1024 * 1024 * 64
)
type AssetParseResult struct {
@ -828,6 +829,12 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
return
}
if PDFAssetContentMaxSize < len(pdfData) {
// PDF files larger than 64MB are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9500
logging.LogWarnf("ignore large PDF asset [%s] with [%s]", absPath, humanize.Bytes(uint64(len(pdfData))))
return
}
// next setup worker pool for processing PDF pages
pages := make(chan *pdfPage, pc.PageCount)
results := make(chan *pdfTextResult, pc.PageCount)