From 430e4195cd91e34264d421d13442802867acfdfe Mon Sep 17 00:00:00 2001 From: YDKK Date: Mon, 9 Sep 2024 01:19:59 +0900 Subject: [PATCH] fix #14 --- SlackLineBridge/Controllers/WebhookController.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/SlackLineBridge/Controllers/WebhookController.cs b/SlackLineBridge/Controllers/WebhookController.cs index 9e89a0b..b421058 100644 --- a/SlackLineBridge/Controllers/WebhookController.cs +++ b/SlackLineBridge/Controllers/WebhookController.cs @@ -154,7 +154,7 @@ private async Task PushToLine(string host, SlackChannel slackChan } //URLタグを抽出 - var urls = UrlRegex().Matches(text); + text = UrlRegex().Replace(text, "${url}"); var client = clientFactory.CreateClient("Line"); foreach (var bridge in bridges) @@ -178,11 +178,6 @@ private async Task PushToLine(string host, SlackChannel slackChan iconUrl = $"https://{host}/proxy/slack/{Crypt.GetHMACHex(userIconUrl, _slackSigningSecret)}/{HttpUtility.UrlEncode(userIconUrl)}" }, }; - var urlMessages = urls.Select(x => x.Groups["url"].Value).Select(x => new - { - type = "text", - text = x - }); var json = new { @@ -190,7 +185,7 @@ private async Task PushToLine(string host, SlackChannel slackChan messages = new dynamic[] { message - }.Concat(urlMessages).ToArray() + }.ToArray() }; var jsonStr = JsonSerializer.Serialize(json); logger.LogInformation("Push message to LINE: {jsonStr}", jsonStr);