Skip to content

Commit

Permalink
FIX: escape text incase if html tags are present
Browse files Browse the repository at this point in the history
  • Loading branch information
EverythingSuckz committed Sep 12, 2022
1 parent 1816158 commit 4696e63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github-telegram-notify/types"
"html"
"io/ioutil"
"net/http"
"net/url"
Expand All @@ -14,7 +15,8 @@ func SendMessage(token string, chatID string, text string, markupText string, ma
req_url, _ := url.Parse(fmt.Sprint(apiBaseUri, "/bot", token, "/sendMessage"))
params := url.Values{}
params.Set("chat_id", chatID)
params.Set("text", text)
escaped_text := html.EscapeString(text)
params.Set("text", escaped_text)
params.Set("parse_mode", "html")
params.Set("disable_web_page_preview", "true")
kyb, err := json.Marshal(map[string][][]map[string]string{
Expand Down

0 comments on commit 4696e63

Please sign in to comment.