mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Parsing message with empty CC
This commit is contained in:
@ -152,6 +152,10 @@ func parseAddressComment(raw string) string {
|
||||
}
|
||||
|
||||
func parseAddressList(val string) (addrs []*mail.Address, err error) {
|
||||
if val == "" {
|
||||
return
|
||||
}
|
||||
|
||||
addrs, err = mail.ParseAddressList(parseAddressComment(val))
|
||||
if err == nil {
|
||||
if addrs == nil {
|
||||
|
||||
@ -224,6 +224,21 @@ func TestParseTextPlainWithPlainAttachment(t *testing.T) {
|
||||
assert.Equal(t, readerToString(attReaders[0]), "attachment")
|
||||
}
|
||||
|
||||
func TestParseTextPlainEmptyCC(t *testing.T) {
|
||||
f := getFileReader("text_plain_empty_cc.eml")
|
||||
|
||||
m, _, plainBody, attReaders, err := Parse(f, "", "")
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `"Sender" <sender@pm.me>`, m.Sender.String())
|
||||
assert.Equal(t, `"Receiver" <receiver@pm.me>`, m.ToList[0].String())
|
||||
|
||||
assert.Equal(t, "body", m.Body)
|
||||
assert.Equal(t, "body", plainBody)
|
||||
|
||||
assert.Len(t, attReaders, 0)
|
||||
}
|
||||
|
||||
func TestParseTextPlainWithImageInline(t *testing.T) {
|
||||
f := getFileReader("text_plain_image_inline.eml")
|
||||
|
||||
|
||||
5
pkg/message/testdata/text_plain_empty_cc.eml
vendored
Normal file
5
pkg/message/testdata/text_plain_empty_cc.eml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
From: Sender <sender@pm.me>
|
||||
To: Receiver <receiver@pm.me>
|
||||
CC:
|
||||
|
||||
body
|
||||
Reference in New Issue
Block a user