Skip to content

Commit 4696e63

Browse files
FIX: escape text incase if html tags are present
1 parent 1816158 commit 4696e63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils/telegram.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"github-telegram-notify/types"
7+
"html"
78
"io/ioutil"
89
"net/http"
910
"net/url"
@@ -14,7 +15,8 @@ func SendMessage(token string, chatID string, text string, markupText string, ma
1415
req_url, _ := url.Parse(fmt.Sprint(apiBaseUri, "/bot", token, "/sendMessage"))
1516
params := url.Values{}
1617
params.Set("chat_id", chatID)
17-
params.Set("text", text)
18+
escaped_text := html.EscapeString(text)
19+
params.Set("text", escaped_text)
1820
params.Set("parse_mode", "html")
1921
params.Set("disable_web_page_preview", "true")
2022
kyb, err := json.Marshal(map[string][][]map[string]string{

0 commit comments

Comments
 (0)