From bc5d78cd943cff84b860502650bf7dce3052b652 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Thu, 25 Jan 2024 14:46:51 +0100 Subject: [PATCH] fix(pkg/test): cast mime-bundle content to appropriate type --- pkg/test/cell.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/test/cell.go b/pkg/test/cell.go index 96c6379..5d139a3 100644 --- a/pkg/test/cell.go +++ b/pkg/test/cell.go @@ -166,7 +166,15 @@ func (mb mimebundle) MimeType() string { } func (mb mimebundle) Text() []byte { - return mb[mb.MimeType()].([]byte) + if txt, ok := mb[mb.MimeType()]; ok { + switch v := txt.(type) { + case []byte: + return v + case string: + return []byte(v) + } + } + return nil } func (mb mimebundle) PlainText() []byte {