aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/facts.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/engine/facts.go')
-rw-r--r--internal/engine/facts.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/engine/facts.go b/internal/engine/facts.go
index 487604b..ccdf18d 100644
--- a/internal/engine/facts.go
+++ b/internal/engine/facts.go
@@ -4,6 +4,7 @@ package engine
import (
"context"
+ "errors"
"path/filepath"
"sort"
"strings"
@@ -178,7 +179,13 @@ func (f *facts) ContentContains(opt cond.Options, keywords []string) (int, error
func (f *facts) extract(opt cond.Options, keywords []string) {
f.contentDone = true
text, err := f.run.e.Extract.Text(f.run.ctx, f.file.Path, f.file.Size, f.run.d.Settings.MaxRead)
- if err != nil {
+ switch {
+ case errors.Is(err, extract.ErrUnsupported):
+ // A format with no text cannot contain a keyword: every answer is
+ // no, with no warning, and the answers are cached like any other
+ // (re-review N2). Only a real read failure is "unreadable".
+ text = ""
+ case err != nil:
f.contentErr = err
return
}