From 153377a3c0892bc94e678c7d11a172e2036bfd84 Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Thu, 21 Nov 2024 11:19:29 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20EscapeSt?= =?UTF-8?q?ring()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/date.txt | 2 +- bin/subversion.txt | 2 +- go.mod | 2 +- go.sum | 4 ++-- internal/telegram/telegram.go | 11 ++++++++++- pkg/version/version.txt | 2 +- .../ManyakRus/starter/telegram_bot/telegram_bot.go | 3 +-- vendor/modules.txt | 2 +- 8 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bin/date.txt b/bin/date.txt index 6497d76..6689711 100644 --- a/bin/date.txt +++ b/bin/date.txt @@ -1 +1 @@ -2024-11-21 07:34:31.530 \ No newline at end of file +2024-11-21 08:19:21.561 \ No newline at end of file diff --git a/bin/subversion.txt b/bin/subversion.txt index 1a12033..2234926 100644 --- a/bin/subversion.txt +++ b/bin/subversion.txt @@ -1 +1 @@ -00188 \ No newline at end of file +00189 \ No newline at end of file diff --git a/go.mod b/go.mod index 6501707..f2caf46 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ManyakRus/telegram_loki go 1.22.1 require ( - github.com/ManyakRus/starter v1.0.86 + github.com/ManyakRus/starter v1.0.87 github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 github.com/golang-module/carbon/v2 v2.4.1 github.com/jackc/pgx/v5 v5.7.1 diff --git a/go.sum b/go.sum index 0294362..31ff4bf 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY= github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 h1:bxwxD0H3kSUAH3uNk/b74gkImcUiP7dyibmMoVwk338= github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792/go.mod h1:OUyxCVbPW/2lC1e6cM7Am941SJiC88BhNnb24x2R3a8= -github.com/ManyakRus/starter v1.0.86 h1:saxWu1qper3moVXzN1rf3cc2zCIHk4Y6X4Kxvgo8V5Y= -github.com/ManyakRus/starter v1.0.86/go.mod h1:ildteZO1poRllhuCistAbG14f/BGjCkCG4dnf5DwfUE= +github.com/ManyakRus/starter v1.0.87 h1:AReqS2A6QaoB8NhSCR/ka73jQ+6qeGBvRZLck98u4Mw= +github.com/ManyakRus/starter v1.0.87/go.mod h1:ildteZO1poRllhuCistAbG14f/BGjCkCG4dnf5DwfUE= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= diff --git a/internal/telegram/telegram.go b/internal/telegram/telegram.go index ff133b6..1879b75 100644 --- a/internal/telegram/telegram.go +++ b/internal/telegram/telegram.go @@ -11,6 +11,7 @@ import ( "github.com/ManyakRus/telegram_loki/internal/load_json" "github.com/ManyakRus/telegram_loki/internal/types" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" + "html" "strings" ) @@ -39,8 +40,12 @@ func SendMessage(Message1 types.Message) error { TextDate = "" } DeveloperName := Message1.DeveloperName - Text := Message1.Text + //экранируем запрещённые символы + Text := Message1.Text + Text = html.EscapeString(Text) + + // TextServiceName := Message1.ServiceName if Message1.LokiURL != "" { TextServiceName = `` + Message1.ServiceName + "" @@ -70,7 +75,11 @@ func SendMessage(Message1 types.Message) error { return err } + //экранируем запрещённые символы Text = Message1.Text + Text = html.EscapeString(Text) + + // if TextServiceName != "" { Text = TextServiceName + "\n" + Text } diff --git a/pkg/version/version.txt b/pkg/version/version.txt index 6cfacca..951f0b4 100644 --- a/pkg/version/version.txt +++ b/pkg/version/version.txt @@ -1 +1 @@ -335cc3a 2024-11-21 10:22:35 +0300 +8d260a0 2024-11-21 10:35:03 +0300 diff --git a/vendor/github.com/ManyakRus/starter/telegram_bot/telegram_bot.go b/vendor/github.com/ManyakRus/starter/telegram_bot/telegram_bot.go index 2647168..78c35b6 100644 --- a/vendor/github.com/ManyakRus/starter/telegram_bot/telegram_bot.go +++ b/vendor/github.com/ManyakRus/starter/telegram_bot/telegram_bot.go @@ -8,7 +8,6 @@ import ( "github.com/ManyakRus/starter/micro" "github.com/ManyakRus/starter/stopapp" botapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" - "html" "os" "sync" ) @@ -143,7 +142,7 @@ func SendMessage(UserName string, Text string) (int, error) { var err error //экранируем запрещённые символы - Text = html.EscapeString(Text) + //Text = html.EscapeString(Text) // msg := botapi.NewMessageToChannel(UserName, Text) diff --git a/vendor/modules.txt b/vendor/modules.txt index 4fe7866..54ec9d2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,7 +4,7 @@ github.com/DataDog/zstd # github.com/ManyakRus/logrus v0.0.0-20231019115155-9e6fede0d792 ## explicit; go 1.13 github.com/ManyakRus/logrus -# github.com/ManyakRus/starter v1.0.86 +# github.com/ManyakRus/starter v1.0.87 ## explicit; go 1.22.1 github.com/ManyakRus/starter/config_main github.com/ManyakRus/starter/contextmain