diff --git a/src/go.mod b/src/go.mod index dca48f734..3443873a6 100644 --- a/src/go.mod +++ b/src/go.mod @@ -4,9 +4,13 @@ go 1.21 replace github.com/kopia/kopia => github.com/alcionai/kopia v0.12.2-0.20231205231702-863c24d6f8b1 -// No tags in the alcion fork of the repo so use v7 as that's in the import -// path. -replace github.com/minio/minio-go/v7 => github.com/alcionai/minio-go/v7 v7.0.0-20231130221740-c745a3d084aa +replace ( + // No tags in the alcion fork of the repo so use v7 as that's in the import path. + github.com/minio/minio-go/v7 => github.com/alcionai/minio-go/v7 v7.0.0-20231130221740-c745a3d084aa + + // Alcion fork removes the validation of email addresses as we might get incomplete email addresses + github.com/xhit/go-simple-mail/v2 v2.16.0 => github.com/alcionai/go-simple-mail/v2 v2.0.0-20231216082222-e8c58c45d8a5 +) require ( github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 diff --git a/src/go.sum b/src/go.sum index 8e518907c..972d78bdf 100644 --- a/src/go.sum +++ b/src/go.sum @@ -17,6 +17,8 @@ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpH github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/alcionai/clues v0.0.0-20231115004051-523cbddac8e8 h1:kdpkhcKWWxnZFteGjglHvFTTPCPsvjhKDDY9J1Od6Sg= github.com/alcionai/clues v0.0.0-20231115004051-523cbddac8e8/go.mod h1:hGnRqQtV7YoojQSNMtqFK0TvfcwAljGZhUEQwx1lw34= +github.com/alcionai/go-simple-mail/v2 v2.0.0-20231216082222-e8c58c45d8a5 h1:4Vgk6zqk9lh5E1E/okrCjB+3ueyGO8BC2uC0tWtDORQ= +github.com/alcionai/go-simple-mail/v2 v2.0.0-20231216082222-e8c58c45d8a5/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4teeyG4MKqB3utRu98= github.com/alcionai/kopia v0.12.2-0.20231205231702-863c24d6f8b1 h1:UM4YDqNmwRsajtoQT4BkMCRrjIeMDwTuTbJs5fPQTTA= github.com/alcionai/kopia v0.12.2-0.20231205231702-863c24d6f8b1/go.mod h1:f4PligAuyEicX+lfTlZltc69nM0eMoXX2nE5sCBdo6Y= github.com/alcionai/minio-go/v7 v7.0.0-20231130221740-c745a3d084aa h1:PHzp5TkXgsardwMG6O2nnyk3zBsGW8CqgsOWQCYkykQ= @@ -336,8 +338,6 @@ github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1S github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= github.com/vbauerster/mpb/v8 v8.1.6 h1:EswHDkAsy4OQ7QBAmU1MUPz4vHzl6KlINjlh7vJoxvY= github.com/vbauerster/mpb/v8 v8.1.6/go.mod h1:O9/Wl8X9dUbR63tZ41MLIAxrtNfwlpwUhGkeYugUPW8= -github.com/xhit/go-simple-mail/v2 v2.16.0 h1:ouGy/Ww4kuaqu2E2UrDw7SvLaziWTB60ICLkIkNVccA= -github.com/xhit/go-simple-mail/v2 v2.16.0/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4teeyG4MKqB3utRu98= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c/go.mod h1:UrdRz5enIKZ63MEE3IF9l2/ebyx59GyGgPi+tICQdmM= github.com/zalando/go-keyring v0.2.3 h1:v9CUu9phlABObO4LPWycf+zwMG7nlbb3t/B5wa97yms= diff --git a/src/internal/converters/eml/eml.go b/src/internal/converters/eml/eml.go index 3f1421a13..26e0fcb0c 100644 --- a/src/internal/converters/eml/eml.go +++ b/src/internal/converters/eml/eml.go @@ -30,6 +30,14 @@ func formatAddress(entry models.EmailAddressable) string { name := ptr.Val(entry.GetName()) email := ptr.Val(entry.GetAddress()) + if len(name) == 0 && len(email) == 0 { + return "" + } + + if len(email) == 0 { + return fmt.Sprintf(`"%s"`, name) + } + if name == email || len(name) == 0 { return email } diff --git a/src/internal/converters/eml/eml_test.go b/src/internal/converters/eml/eml_test.go index 61eb8e1d1..53f705c3a 100644 --- a/src/internal/converters/eml/eml_test.go +++ b/src/internal/converters/eml/eml_test.go @@ -53,6 +53,18 @@ func (suite *EMLUnitSuite) TestFormatAddress() { email: "johndoe@provider.com", expected: "johndoe@provider.com", }, + { + tname: "only name", + name: "john doe", + email: "", + expected: `"john doe"`, + }, + { + tname: "neither mail or name", + name: "", + email: "", + expected: "", + }, } for _, tt := range tests {