From 7bf70c4d7152f5e20ffa89698e90570a9d23023f Mon Sep 17 00:00:00 2001 From: "Greg T. Wallace" Date: Tue, 18 Jun 2024 21:30:39 -0400 Subject: [PATCH] ssh: switch string comps to EqualFold func --- pkg/apcssh/cmd_restartwebui.go | 2 +- pkg/apcssh/ssl.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/apcssh/cmd_restartwebui.go b/pkg/apcssh/cmd_restartwebui.go index 4b904c1..bde8d3a 100644 --- a/pkg/apcssh/cmd_restartwebui.go +++ b/pkg/apcssh/cmd_restartwebui.go @@ -16,7 +16,7 @@ func (cli *Client) RestartWebUI() error { return err } - if strings.ToLower(result.code) != "e000" { + if !strings.EqualFold(result.code, "e000") { return fmt.Errorf("apcssh: failed to restart web ui (%s: %s)", result.code, result.codeText) } diff --git a/pkg/apcssh/ssl.go b/pkg/apcssh/ssl.go index c3fac28..233ea38 100644 --- a/pkg/apcssh/ssl.go +++ b/pkg/apcssh/ssl.go @@ -15,7 +15,7 @@ func (cli *Client) InstallSSLCert(keyP15 []byte, certPem []byte, keyCertP15 []by return fmt.Errorf("apcssh: ssl cert install: failed to send ssl cmd (%w)", err) } // E101 is the code for "Command Not Found" - supportsSSLCmd := strings.ToLower(result.code) != "e101" + supportsSSLCmd := !strings.EqualFold(result.code, "e101") // if SSL is supported, use that method if supportsSSLCmd { @@ -46,7 +46,7 @@ func (cli *Client) installSSLCertModern(keyP15 []byte, certPem []byte) error { if err != nil { return fmt.Errorf("apcssh: ssl cert install: failed to send ssl key install cmd (%w)", err) } - if strings.ToLower(result.code) != "e000" { + if !strings.EqualFold(result.code, "e000") { return fmt.Errorf("apcssh: ssl cert install: ssl key install cmd returned error code (%s: %s)", result.code, result.codeText) } @@ -54,7 +54,7 @@ func (cli *Client) installSSLCertModern(keyP15 []byte, certPem []byte) error { if err != nil { return fmt.Errorf("apcssh: ssl cert install: failed to send ssl cert install cmd (%w)", err) } - if strings.ToLower(result.code) != "e000" { + if !strings.EqualFold(result.code, "e000") { return fmt.Errorf("apcssh: ssl cert install: ssl cert install cmd returned error code (%s: %s)", result.code, result.codeText) }