Skip to content

Commit 66ba136

Browse files
XaytonMatteoPologruto
authored andcommitted
Fix check for pressed buttons
1 parent a438fed commit 66ba136

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

certificates/certificates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func PromptInstallCertsSafari() bool {
287287
}
288288
oscmd := exec.Command("osascript", "-e", "display dialog \"The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\nIf you use Safari, you need to install it.\" buttons {\"Do not install\", \"Install the certificate for Safari\"} default button 2 with title \"Arduino Agent: Install Certificates\"")
289289
pressed, _ := oscmd.Output()
290-
return string(pressed) == "button returned:Install the certificate for Safari"
290+
return strings.Contains(string(pressed), "button returned:Install the certificate for Safari")
291291
}
292292

293293
// PromptExpiredCerts prompts the user to update the HTTPS certificates if they are using Safari
@@ -296,7 +296,7 @@ func PromptExpiredCerts(certDir *paths.Path) {
296296
log.Errorf("cannot check if certificates are expired something went wrong: %s", err)
297297
} else if expired {
298298
oscmd := exec.Command("osascript", "-e", "display dialog \"The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\nYour certificate is expired or close to expiration. Do you want to update it?\" buttons {\"Do not update\", \"Update the certificate for Safari\"} default button 2 with title \"Arduino Agent: Update Certificates\"")
299-
if pressed, _ := oscmd.Output(); string(pressed) == "button returned:Update the certificate for Safari" {
299+
if pressed, _ := oscmd.Output(); strings.Contains(string(pressed), "button returned:Update the certificate for Safari") {
300300
err := UninstallCertificates()
301301
if err != nil {
302302
log.Errorf("cannot uninstall certificates something went wrong: %s", err)

0 commit comments

Comments
 (0)