diff --git a/core/src/main/java/hudson/tools/ZipExtractionInstaller.java b/core/src/main/java/hudson/tools/ZipExtractionInstaller.java index 1e1c171f6a95..4646980ea8d6 100644 --- a/core/src/main/java/hudson/tools/ZipExtractionInstaller.java +++ b/core/src/main/java/hudson/tools/ZipExtractionInstaller.java @@ -43,6 +43,8 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.nio.file.FileSystemNotFoundException; +import java.nio.file.Path; import jenkins.MasterToSlaveFileCallable; import jenkins.model.Jenkins; import org.jenkinsci.Symbol; @@ -117,6 +119,14 @@ public FormValidation doCheckUrl(@QueryParameter String value) throws Interrupte } catch (URISyntaxException e) { return FormValidation.error(e, Messages.ZipExtractionInstaller_malformed_url()); } + if (uri.getScheme() != null && !uri.getScheme().startsWith("http")) { + try { + Path.of(uri); + return FormValidation.ok(); + } catch (FileSystemNotFoundException | IllegalArgumentException e) { + return FormValidation.error(e, Messages.ZipExtractionInstaller_malformed_url()); + } + } HttpClient httpClient = ProxyConfiguration.newHttpClient(); HttpRequest httpRequest; try {