🎨 导入 .sy.zip 时增量建立索引 https://github.com/siyuan-note/siyuan/issues/7123

This commit is contained in:
Liang Ding 2023-01-19 17:13:27 +08:00
parent 7401ae845a
commit 772984fe1b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 51 additions and 6 deletions

View file

@ -59,11 +59,20 @@ func GetAssetText(asset string) string {
return ret
}
func IsTesseractExtractable(p string) bool {
lowerName := strings.ToLower(p)
return strings.HasSuffix(lowerName, ".png") || strings.HasSuffix(lowerName, ".jpg") || strings.HasSuffix(lowerName, ".jpeg")
}
func Tesseract(imgAbsPath string) string {
if ContainerStd != Container || !TesseractEnabled {
return ""
}
if !IsTesseractExtractable(imgAbsPath) {
return ""
}
info, err := os.Stat(imgAbsPath)
if nil != err {
return ""