Parcourir la source

Strip \r to avoid sending multiple IRC messages

tags/v0.3.4
Russ Garrett il y a 5 ans
Parent
révision
a415d782dd
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3
    1
      httplistener/templates.go

+ 3
- 1
httplistener/templates.go Voir le fichier

@@ -84,7 +84,9 @@ func (hl *HTTPListener) renderTemplate(tpl_name string, data interface{}) ([]str
84 84
 		return []string{}, errors.New("Nonexistent template")
85 85
 	}
86 86
 	t.Execute(&out, data)
87
-	return strings.Split(out.String(), "\n"), nil
87
+	// The \r character is also a delimiter in IRC so strip it out.
88
+	outStr := strings.Replace(out.String(), "\r", "", -1)
89
+	return strings.Split(outStr, "\n"), nil
88 90
 }
89 91
 
90 92
 // We need this additional struct and function because the GitHub webhook package represents

Chargement…
Annuler
Enregistrer