Skip to content

Commit 3856d57

Browse files
committed
fix: fallback to releases.coder.com was not properly treated
1 parent 26a94c1 commit 3856d57

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/main/kotlin/com/coder/toolbox/cli/CoderCLIManager.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,22 @@ class CoderCLIManager(
204204
} else {
205205
throw UnsignedBinaryExecutionDeniedException("Running unsigned CLI from ${cliResult.source} was denied by the user")
206206
}
207+
}
208+
} else {
209+
// we are not allowed to fetch signatures from releases.coder.com
210+
// so we will ask the user if he wants to continue
211+
val acceptsUnsignedBinary = context.ui.showYesNoPopup(
212+
context.i18n.ptrl("Security Warning"),
213+
context.i18n.pnotr("No signatures were found for ${cliResult.source} and fallback to releases.coder.com is not allowed. Would you like to run it anyway?"),
214+
context.i18n.ptrl("Accept"),
215+
context.i18n.ptrl("Abort"),
216+
)
217+
218+
if (acceptsUnsignedBinary) {
219+
downloader.commit()
220+
return true
207221
} else {
208-
// we could not fetch signatures from releases.coder.com
209-
// so we will ask the user if he wants to continue
210-
val acceptsUnsignedBinary = context.ui.showYesNoPopup(
211-
context.i18n.ptrl("Security Warning"),
212-
context.i18n.pnotr("No signatures were found for ${cliResult.source} and fallback to releases.coder.com is not allowed. Would you like to run it anyway?"),
213-
context.i18n.ptrl("Accept"),
214-
context.i18n.ptrl("Abort"),
215-
)
216-
217-
if (acceptsUnsignedBinary) {
218-
downloader.commit()
219-
return true
220-
} else {
221-
throw UnsignedBinaryExecutionDeniedException("Running unsigned CLI from ${cliResult.source} was denied by the user")
222-
}
222+
throw UnsignedBinaryExecutionDeniedException("Running unsigned CLI from ${cliResult.source} was denied by the user")
223223
}
224224
}
225225
}

0 commit comments

Comments
 (0)