Skip to content

Commit

Permalink
fix: ensure block existence check is performed for empty server names
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Feb 13, 2025
1 parent 0e311e6 commit edc5274
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/pkg/rpaas/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func (m *mutation) UpdateBlock(block ConfigurationBlock) error {
}

func (m *mutation) DeleteBlock(serverName, blockName string) error {
if m.spec.Blocks == nil {
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
}

blockType := v1alpha1.BlockType(blockName)

if serverName == "" {
if m.spec.Blocks == nil {
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
}

if _, ok := m.spec.Blocks[blockType]; !ok {
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
}
Expand Down

0 comments on commit edc5274

Please sign in to comment.