From 2e44153c8fe1989f4f4eabb183f9d50d248135ff Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:17:35 +0100 Subject: [PATCH] Fix uploading file to thread (#1016) --- .../jenkins/plugins/slack/cache/SlackChannelIdCache.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java b/src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java index d6d83fd0..8ba16812 100644 --- a/src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java +++ b/src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java @@ -73,11 +73,10 @@ public long getRetryInterval() { } public static String getChannelId(String botUserToken, String channel) throws ExecutionException, InterruptedException, AbortException { - if (channel.matches("^(C[A-Z0-9]{8}|G[A-Z0-9]{10}||D[A-Z0-9]{8})$")) { - return channel; - } - String channelName = cleanChannelName(channel); + if (channelName.matches("^(C[A-Z0-9]{8}|C[A-Z0-9]{10}|G[A-Z0-9]{10}|D[A-Z0-9]{8})$")) { + return channelName; + } Map channelNameToIdMap = CHANNEL_METADATA_CACHE.get(botUserToken); String channelId = channelNameToIdMap.get(channelName);