Skip to content

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

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

Daniel17b598b03334
diff --git a/kernel/model/asset_content.go b/kernel/model/asset_content.go
index b1b9315457..cfd356e02e 100644
--- a/kernel/model/asset_content.go
+++ b/kernel/model/asset_content.go
@@ -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)