From 711eb913fe455ffe5c9d717b44762801820c0e8c Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:20:27 -0500 Subject: [PATCH] fix: check []bytes > 0 instead of nil (#2667) Fixes: #2647 --- internal/creds.go | 2 +- internal/settings.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/creds.go b/internal/creds.go index e6c4fe90d4..5ea555ed01 100644 --- a/internal/creds.go +++ b/internal/creds.go @@ -127,7 +127,7 @@ func baseCreds(ctx context.Context, ds *DialSettings) (*google.Credentials, erro if ds.Credentials != nil { return ds.Credentials, nil } - if ds.CredentialsJSON != nil { + if len(ds.CredentialsJSON) > 0 { return credentialsFromJSON(ctx, ds.CredentialsJSON, ds) } if ds.CredentialsFile != "" { diff --git a/internal/settings.go b/internal/settings.go index 6d0c18e5a8..edba49af49 100644 --- a/internal/settings.go +++ b/internal/settings.go @@ -126,7 +126,7 @@ func (ds *DialSettings) Validate() error { if ds.Credentials != nil { nCreds++ } - if ds.CredentialsJSON != nil { + if len(ds.CredentialsJSON) > 0 { nCreds++ } if ds.CredentialsFile != "" {