mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-23 08:01:48 +00:00
misc: use errors.As instead of type checking
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
parent
ce3e264c7d
commit
22134b1233
1 changed files with 2 additions and 4 deletions
|
|
@ -539,10 +539,8 @@ func maskDockerconfigjsonSopsData(dataMap map[string]string, encode bool) error
|
||||||
func maskBase64EncryptedSopsData(dataMap map[string]string, mask string) error {
|
func maskBase64EncryptedSopsData(dataMap map[string]string, mask string) error {
|
||||||
for k, v := range dataMap {
|
for k, v := range dataMap {
|
||||||
data, err := base64.StdEncoding.DecodeString(v)
|
data, err := base64.StdEncoding.DecodeString(v)
|
||||||
if err != nil {
|
if corruptErr := base64.CorruptInputError(0); errors.As(err, &corruptErr) {
|
||||||
if _, ok := err.(base64.CorruptInputError); ok {
|
return corruptErr
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Contains(data, []byte("sops")) && bytes.Contains(data, []byte("ENC[")) {
|
if bytes.Contains(data, []byte("sops")) && bytes.Contains(data, []byte("ENC[")) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue