Browse Source

Strip \r to avoid sending multiple IRC messages

tags/v0.3.4
Russ Garrett 5 years ago
parent
commit
a415d782dd
No account linked to committer's email address
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      httplistener/templates.go

+ 3
- 1
httplistener/templates.go View File

@@ -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

Loading…
Cancel
Save