Skip to content

Commit

Permalink
[FIXED] Correct error returned by DeleteObjectStore (#1762)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelattwood authored Jan 7, 2025
1 parent 7188ea1 commit 1474bf3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jetstream/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,17 @@ func (js *jetStream) ObjectStore(ctx context.Context, bucket string) (ObjectStor

// DeleteObjectStore will delete the underlying stream for the named object.
func (js *jetStream) DeleteObjectStore(ctx context.Context, bucket string) error {
if !validBucketRe.MatchString(bucket) {
return ErrInvalidStoreName
}
stream := fmt.Sprintf(objNameTmpl, bucket)
return js.DeleteStream(ctx, stream)
if err := js.DeleteStream(ctx, stream); err != nil {
if errors.Is(err, ErrStreamNotFound) {
err = errors.Join(fmt.Errorf("%w: %s", ErrBucketNotFound, bucket), err)
}
return err
}
return nil
}

func encodeName(name string) string {
Expand Down

0 comments on commit 1474bf3

Please sign in to comment.