From 394d117b90ffb64c87adfc8c2436b57007840c2b Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 22:23:42 +0200 Subject: plan 10: a format with no text is no match, not unreadable --- internal/engine/facts.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/engine/facts.go') 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 } -- cgit v1.3