mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 PDF files larger than 128MB are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9500
This commit is contained in:
parent
e50f23ba02
commit
05d045b1e6
4 changed files with 171 additions and 15 deletions
|
|
@ -480,7 +480,10 @@ func NewAssetsSearcher() *AssetsSearcher {
|
|||
const (
|
||||
TxtAssetContentMaxSize = 1024 * 1024 * 4
|
||||
PDFAssetContentMaxPage = 1024
|
||||
PDFAssetContentMaxSize = 1024 * 1024 * 128
|
||||
)
|
||||
|
||||
var (
|
||||
PDFAssetContentMaxSize uint64 = 1024 * 1024 * 128
|
||||
)
|
||||
|
||||
type AssetParseResult struct {
|
||||
|
|
@ -829,7 +832,18 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
|
|||
return
|
||||
}
|
||||
|
||||
if PDFAssetContentMaxSize < len(pdfData) {
|
||||
if maxSizeVal := os.Getenv("SIYUAN_PDF_ASSET_CONTENT_INDEX_MAX_SIZE"); "" != maxSizeVal {
|
||||
if maxSize, parseErr := strconv.ParseUint(maxSizeVal, 10, 64); nil == parseErr {
|
||||
if maxSize != PDFAssetContentMaxSize {
|
||||
PDFAssetContentMaxSize = maxSize
|
||||
logging.LogInfof("set PDF asset content index max size to [%s]", humanize.Bytes(maxSize))
|
||||
}
|
||||
} else {
|
||||
logging.LogWarnf("invalid env [SIYUAN_PDF_ASSET_CONTENT_INDEX_MAX_SIZE]: [%s], parsing failed: ", maxSizeVal, parseErr)
|
||||
}
|
||||
}
|
||||
|
||||
if PDFAssetContentMaxSize < uint64(len(pdfData)) {
|
||||
// PDF files larger than 128MB 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue