From 566a74d01f862bc05a6400b84759859a308fc31a Mon Sep 17 00:00:00 2001 From: feistel <6742251-feistel@users.noreply.gitlab.com> Date: Wed, 11 Aug 2021 19:04:48 +0000 Subject: fix: make sure ErrCafileNotFound is returned only when the file doesn't exist --- client/httpclient.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/httpclient.go b/client/httpclient.go index 15bae25..fceb0f4 100644 --- a/client/httpclient.go +++ b/client/httpclient.go @@ -84,7 +84,10 @@ func NewHTTPClientWithOpts(gitlabURL, gitlabRelativeURLRoot, caFile, caPath stri } if _, err := os.Stat(caFile); err != nil { - return nil, fmt.Errorf("cannot find cafile '%s': %w", caFile, ErrCafileNotFound) + if os.IsNotExist(err) { + return nil, fmt.Errorf("cannot find cafile '%s': %w", caFile, ErrCafileNotFound) + } + return nil, err } transport, host, err = buildHttpsTransport(*hcc, selfSignedCert, gitlabURL) -- cgit v1.2.1