Skip to content

Commit

Permalink
fix(pkg/test): cast mime-bundle content to appropriate type
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzzz committed Jan 25, 2024
1 parent d3f8a53 commit bc5d78c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/test/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bc5d78c

Please sign in to comment.