Skip to content

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

:lock: Skip encrypted notebook assets in FullIndex and auto OCR to prevent ciphertext polluting search index #18034

Daniel2784c5ff05da
diff --git a/kernel/model/asset_content.go b/kernel/model/asset_content.go
index 2c4d8058ca..13d5e744eb 100644
--- a/kernel/model/asset_content.go
+++ b/kernel/model/asset_content.go
@@ -415,6 +415,11 @@ func (searcher *AssetsSearcher) FullIndex() {
return nil
}
+ // 加密笔记本的 asset 是密文,跳过全量内容索引(避免密文污染搜索索引、泄漏文件名集合)
+ if IsEncryptedAssetPath(absPath) {
+ return nil
+ }
+
ext := filepath.Ext(absPath)
parser := searcher.GetParser(ext)
if nil == parser {
diff --git a/kernel/model/ocr.go b/kernel/model/ocr.go
index 96c2e3f26d..9eb6965013 100644
--- a/kernel/model/ocr.go
+++ b/kernel/model/ocr.go
@@ -67,6 +67,10 @@ func getUnOCRAssetsAbsPaths() (ret []string) {
continue
}
absPath := filepath.Join(assetsPath, strings.TrimPrefix(asset.Path, "assets"))
+ // 加密笔记本的 asset 是密文,跳过 OCR(避免密文图片产出垃圾文本污染搜索索引)
+ if IsEncryptedAssetPath(absPath) {
+ continue
+ }
ret = append(ret, absPath)
}
return