From 2200c8d692ba4af64732e5ae9f1a8b1399150974 Mon Sep 17 00:00:00 2001 From: ivanovEV Date: Thu, 14 Mar 2024 20:18:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20ht?= =?UTF-8?q?tp=20=D0=BD=D0=B0=20isvalidurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pulsar/jenkins/library/steps/GetExtensions.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 + } + } }