mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2024-12-04 10:34:42 +02:00
заменил http на isvalidurl
This commit is contained in:
parent
2bfb7c8e4a
commit
8b9f047e36
@ -72,7 +72,7 @@ class GetExtensions implements Serializable {
|
|||||||
String pathToExtension = "$env.WORKSPACE/${EXTENSIONS_OUT_DIR}/${extension.name}.cfe"
|
String pathToExtension = "$env.WORKSPACE/${EXTENSIONS_OUT_DIR}/${extension.name}.cfe"
|
||||||
FilePath localPathToExtension = FileUtils.getFilePath(pathToExtension)
|
FilePath localPathToExtension = FileUtils.getFilePath(pathToExtension)
|
||||||
|
|
||||||
if (extension.path.startsWith("http")) {
|
if (isValidUrl(extension.path)) {
|
||||||
// If the path is a URL, download the file
|
// If the path is a URL, download the file
|
||||||
localPathToExtension.copyFrom(new URL(extension.path))
|
localPathToExtension.copyFrom(new URL(extension.path))
|
||||||
} else {
|
} else {
|
||||||
@ -103,4 +103,13 @@ class GetExtensions implements Serializable {
|
|||||||
steps.unzip(sourceDirName, EdtToDesignerFormatTransformation.EXTENSION_ZIP)
|
steps.unzip(sourceDirName, EdtToDesignerFormatTransformation.EXTENSION_ZIP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isValidUrl(String url) {
|
||||||
|
try {
|
||||||
|
new URL(url)
|
||||||
|
return true
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user