From 296a520d8145ff7f61ee3a4bdffb34235cfdbaaf Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 2 Dec 2025 00:31:50 +0000 Subject: [PATCH] test: Add edge case for extractTelegramChatID URL parse error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test URL with control characters triggers url.Parse error path. Coverage: 92.9% → 100% --- internal/notifications/security_utils_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/notifications/security_utils_test.go b/internal/notifications/security_utils_test.go index 615cd01..7794418 100644 --- a/internal/notifications/security_utils_test.go +++ b/internal/notifications/security_utils_test.go @@ -319,6 +319,12 @@ func TestExtractTelegramChatID(t *testing.T) { expectError: true, errorSubstr: "missing chat_id parameter", }, + { + name: "URL with control characters", + webhookURL: "https://api.telegram.org/bot\x00/sendMessage?chat_id=12345", + expectError: true, + errorSubstr: "invalid URL format", + }, } for _, tt := range tests {