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);