diff --git a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy index d2771d9..47bcdd8 100644 --- a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy +++ b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy @@ -72,7 +72,7 @@ class GetExtensions implements Serializable { String pathToExtension = "$env.WORKSPACE/${EXTENSIONS_OUT_DIR}/${extension.name}.cfe" FilePath localPathToExtension = FileUtils.getFilePath(pathToExtension) - if (extension.path.startsWith("http")) { + if (isValidUrl(extension.path)) { // If the path is a URL, download the file localPathToExtension.copyFrom(new URL(extension.path)) } else { @@ -103,4 +103,13 @@ class GetExtensions implements Serializable { steps.unzip(sourceDirName, EdtToDesignerFormatTransformation.EXTENSION_ZIP) } } + + private static boolean isValidUrl(String url) { + try { + new URL(url) + return true + } catch (MalformedURLException e) { + return false + } + } }