diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-11 19:04:48 +0000 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-11 19:04:48 +0000 |
commit | 566a74d01f862bc05a6400b84759859a308fc31a (patch) | |
tree | 6764de59ddc91b267f5dccc9daf8d870352988f1 /client | |
parent | 883615685b54c5a15856b2bbb469c9875bdcbd68 (diff) | |
download | gitlab-shell-566a74d01f862bc05a6400b84759859a308fc31a.tar.gz |
fix: make sure ErrCafileNotFound is returned only when the file doesn't exist
Diffstat (limited to 'client')
-rw-r--r-- | client/httpclient.go | 5 |
1 files changed, 4 insertions, 1 deletions
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) |