aboutsummaryrefslogtreecommitdiff
path: root/internal/extract/plain.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:24:08 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:24:08 +0200
commit11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb (patch)
tree336b39597f95d6b97b460075cb50371c979e733c /internal/extract/plain.go
parentc66a842ce4679a3ffa5504dad39b1402bea75e9f (diff)
downloadkrino-11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb.tar.gz
krino-11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb.zip
text that turns binary further on has no content, like an image
Diffstat (limited to 'internal/extract/plain.go')
-rw-r--r--internal/extract/plain.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/extract/plain.go b/internal/extract/plain.go
index f7470be..3f04c7e 100644
--- a/internal/extract/plain.go
+++ b/internal/extract/plain.go
@@ -38,7 +38,9 @@ func readDecoded(path string) (string, error) {
// the sample alone (UTF-16 text is full of NUL bytes by design), but a
// sample that merely looks like UTF-8 must hold for the WHOLE file — no
// NUL byte anywhere, and no invalid UTF-8 anywhere past the sample — or
-// the file is ErrMixed, unreadable; the Latin-1 fallback in decode
+// the file is ErrUnsupported after all (a self-extracting installer has no
+// text in krino's sense, Łukasz's decision after the plan 10 re-check); the
+// Latin-1 fallback in decode
// never applies to a sniffed file, only to a file whose extension already
// names it as text. D2: when the file continues past the sample (n ==
// sniffSize), the validity check is run against a trimmed copy with any
@@ -81,7 +83,7 @@ func sniffText(path string) (string, error) {
return decode(data), nil
}
if !utf8.Valid(data) || bytes.Contains(data, []byte{0}) {
- return "", ErrMixed
+ return "", ErrUnsupported
}
return decode(data), nil
}