From 6b043d2bb70412a924c5c123883a5136154f97c0 Mon Sep 17 00:00:00 2001 From: tiulpin Date: Wed, 3 Jul 2024 15:53:22 +0200 Subject: [PATCH] :bricks: Fix CLI downloader when a binary exists --- .../main/kotlin/org/jetbrains/qodana/cli/Qodana.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/src/main/kotlin/org/jetbrains/qodana/cli/Qodana.kt b/common/src/main/kotlin/org/jetbrains/qodana/cli/Qodana.kt index f09aaeb5..a4e572e3 100644 --- a/common/src/main/kotlin/org/jetbrains/qodana/cli/Qodana.kt +++ b/common/src/main/kotlin/org/jetbrains/qodana/cli/Qodana.kt @@ -77,9 +77,16 @@ class Installer { fun setup(path: File, downloadURL: String = getQodanaUrl(), version: String = getLatestVersion()): String { if (path.exists()) { - verifyChecksum(path, getChecksum(version)) - return path.absolutePath - } else try { + try { + verifyChecksum(path, getChecksum(version)) + return path.absolutePath + } catch (e: IOException) { + log.warning("Checksum verification failed. Redownloading the binary.") + } + path.delete() + } + + try { download(downloadURL, path) verifyChecksum(path, getChecksum(version)) } catch (e: IOException) {