devops: properly handle double quotes in TG notifications
Since we send JSON, double quotes have to be escaped.
This commit is contained in:
parent
e57c9063b6
commit
a8c6bd66cd
|
|
@ -5,9 +5,10 @@ send_telegram_message() {
|
||||||
if ! command -v curl >/dev/null; then
|
if ! command -v curl >/dev/null; then
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
|
local TEXT=${1//\"/\\\"}
|
||||||
curl --silent \
|
curl --silent \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"chat_id": "-1001225613794", "parse_mode": "html", "text": "'"$1"'", "disable_notification": false}' \
|
-d '{"chat_id": "-1001225613794", "parse_mode": "html", "text": "'"$TEXT"'", "disable_notification": false}' \
|
||||||
https://api.telegram.org/bot$TELEGRAM_BOT_KEY/sendMessage >/dev/null
|
https://api.telegram.org/bot$TELEGRAM_BOT_KEY/sendMessage >/dev/null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue