Skip to content

Commit b1967d4

Browse files
committed
fix: fcli tool definitions update: Ignore spurious intermediate directories in tool-definitions.zip
1 parent 408dd30 commit b1967d4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

fcli-core/fcli-tool/src/main/java/com/fortify/cli/tool/definitions/helper/ToolDefinitionsHelper.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,14 @@ private static List<ToolDefinitionsOutputDescriptor> getOutputDescriptors(String
139139

140140
private static final ToolDefinitionsStateDescriptor update(String source, Path dest) throws IOException {
141141
try {
142-
UnirestHelper.download("tool", new URL(source).toString(), dest.toFile());
142+
var url = new URL(source);
143+
Path tempFile = Files.createTempFile("tool-definitions-", ".zip");
144+
try {
145+
UnirestHelper.download("tool", url.toString(), tempFile.toFile());
146+
mergeDefinitionsZip(dest, tempFile.toString());
147+
} finally {
148+
Files.deleteIfExists(tempFile);
149+
}
143150
} catch (MalformedURLException e) {
144151
if (!isValidZip(source)) {
145152
throw new FcliSimpleException("Invalid tool definitions file", e);

0 commit comments

Comments
 (0)