all: rewrite references to strings.Index to strings.Contains

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
This commit is contained in:
Wagner Riffel 2019-09-03 16:34:05 -03:00 committed by Drew DeVault
parent feacca3c5c
commit baa70469c3
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ func buildBody(args []string) (string, error) {
for _, opt := range opts {
switch opt.Option {
case 'H':
if strings.Index(opt.Value, ":") != -1 {
if strings.Contains(opt.Value, ":") {
// ensure first colon is followed by a single space
re := regexp.MustCompile(`^(.*?):\s*(.*)`)
headers += re.ReplaceAllString(opt.Value, "$1: $2") + "\n"

View File

@ -173,7 +173,7 @@ func parseAddressList(h *mail.Header, key string) ([]*models.Address, error) {
var converted []*models.Address
addrs, err := h.AddressList(key)
if err != nil {
if hdr, err := h.Text(key); err != nil && strings.Index(hdr, "@") < 0 {
if hdr, err := h.Text(key); err != nil && strings.Contains(hdr, "@") {
return []*models.Address{&models.Address{
Name: hdr,
}}, nil