From b752a4da51f5a2ac2d56e6f1f42d779b85d42251 Mon Sep 17 00:00:00 2001 From: Ben Garrett Date: Wed, 3 Jul 2024 14:35:56 +1000 Subject: [PATCH] error fix for small files. --- internal/magicnumber/magicnumber.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/magicnumber/magicnumber.go b/internal/magicnumber/magicnumber.go index ff1fa074..0e47b33f 100644 --- a/internal/magicnumber/magicnumber.go +++ b/internal/magicnumber/magicnumber.go @@ -503,7 +503,7 @@ func Program(r io.Reader) (Signature, error) { func Text(r io.Reader) (Signature, error) { buf := make([]byte, 512) _, err := io.ReadFull(r, buf) - if err != nil { + if err != nil && !errors.Is(err, io.ErrUnexpectedEOF) && !errors.Is(err, io.EOF) { return Unknown, fmt.Errorf("magic number text: %w", err) } txts := Texts()