forked from Silverfish/proton-bridge
Parsing message with empty CC
This commit is contained in:
@ -4,6 +4,9 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-752 Parsing message with empty CC.
|
||||||
|
|
||||||
## [IE 1.1.x] Danube (v1.1.0 beta 2020-09-XX)
|
## [IE 1.1.x] Danube (v1.1.0 beta 2020-09-XX)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@ -152,6 +152,10 @@ func parseAddressComment(raw string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseAddressList(val string) (addrs []*mail.Address, err error) {
|
func parseAddressList(val string) (addrs []*mail.Address, err error) {
|
||||||
|
if val == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
addrs, err = mail.ParseAddressList(parseAddressComment(val))
|
addrs, err = mail.ParseAddressList(parseAddressComment(val))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if addrs == nil {
|
if addrs == nil {
|
||||||
|
|||||||
@ -224,6 +224,21 @@ func TestParseTextPlainWithPlainAttachment(t *testing.T) {
|
|||||||
assert.Equal(t, readerToString(attReaders[0]), "attachment")
|
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) {
|
func TestParseTextPlainWithImageInline(t *testing.T) {
|
||||||
f := getFileReader("text_plain_image_inline.eml")
|
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