Skip to content

Commit

Permalink
Use correct minio error (#26634) (#26639)
Browse files Browse the repository at this point in the history
Backport #26634 by @delvh

Previously, `err` was defined above, checked for `err == nil` and used
nowhere else.
Hence, the result of `convertMinioErr` would always be `nil`.
This leads to a NPE further down the line.
That is not intentional, it should convert the error of the most recent
operation, not one of its predecessors.

Found through
https://discord.com/channels/322538954119184384/322538954119184384/1143185780206993550.

Co-authored-by: delvh <dev.lh@web.de>
  • Loading branch information
GiteaBot and delvh authored Aug 21, 2023
1 parent f43df2f commit a4b1463
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/storage/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
}

// Check to see if we already own this bucket
exists, errBucketExists := minioClient.BucketExists(ctx, config.Bucket)
if errBucketExists != nil {
exists, err := minioClient.BucketExists(ctx, config.Bucket)
if err != nil {
return nil, convertMinioErr(err)
}

Expand Down

0 comments on commit a4b1463

Please sign in to comment.