Skip to content

Commit

Permalink
заменил http на isvalidurl
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanovEV committed Mar 14, 2024
1 parent c30558c commit 2200c8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 2200c8d

Please sign in to comment.