diff --git a/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java b/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java index ebfea0f1..90e73061 100644 --- a/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java +++ b/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java @@ -15,7 +15,7 @@ * Because of the Jenkins.get() used in the constructor, you can only create it on the master, not on an agent. */ public class JenkinsProxyConfiguration extends ProxyConfiguration { - private static final Pattern HOST_NAME_PATTERN = Pattern.compile("^.*?://?([\\w.]+).*"); + private static final Pattern HOST_NAME_PATTERN = Pattern.compile("^.*?://?([\\w.-]+).*"); public List noProxyHostPatterns; public String noProxy; diff --git a/src/test/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfigurationTest.java b/src/test/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfigurationTest.java index f329edff..f3f5d744 100644 --- a/src/test/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfigurationTest.java +++ b/src/test/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfigurationTest.java @@ -1,6 +1,7 @@ package io.jenkins.plugins.jfrog.configuration; import jenkins.model.Jenkins; +import org.apache.commons.lang3.StringUtils; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -63,6 +64,10 @@ public void testShouldBypassProxy() { setupProxy("acme.jfrog.info"); assertFalse(new JenkinsProxyConfiguration().shouldBypassProxy(url)); + + setupProxy("acme.jfrog.io-dashed"); + String dashedUrl = StringUtils.replace(url, "acme.jfrog.io", "acme.jfrog.io-dashed"); + assertTrue(new JenkinsProxyConfiguration().shouldBypassProxy(dashedUrl)); } private void setupProxy(String noProxyHost) {