Skip to content

Commit fb4981a

Browse files
XaytonMatteoPologruto
authored andcommitted
Fix check for pressed buttons
1 parent 482bc24 commit fb4981a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

certificates/certificates.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func PromptInstallCertsSafari() bool {
288288
}
289289
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\"")
290290
pressed, _ := oscmd.Output()
291-
return string(pressed) == "button returned:Install the certificate for Safari"
291+
return strings.Contains(string(pressed), "button returned:Install the certificate for Safari")
292292
}
293293

294294
// PromptExpiredCerts prompts the user to update the HTTPS certificates if they are using Safari
@@ -297,7 +297,7 @@ func PromptExpiredCerts(certDir *paths.Path) {
297297
log.Errorf("cannot check if certificates are expired something went wrong: %s", err)
298298
} else if expired {
299299
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\"")
300-
if pressed, _ := oscmd.Output(); string(pressed) == "button returned:Update the certificate for Safari" {
300+
if pressed, _ := oscmd.Output(); strings.Contains(string(pressed), "button returned:Update the certificate for Safari") {
301301
err := UninstallCertificates()
302302
if err != nil {
303303
log.Errorf("cannot uninstall certificates something went wrong: %s", err)

0 commit comments

Comments
 (0)