Skip to content

Commit edc5274

Browse files
committed
fix: ensure block existence check is performed for empty server names
1 parent 0e311e6 commit edc5274

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/pkg/rpaas/mutation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ func (m *mutation) UpdateBlock(block ConfigurationBlock) error {
6262
}
6363

6464
func (m *mutation) DeleteBlock(serverName, blockName string) error {
65-
if m.spec.Blocks == nil {
66-
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
67-
}
68-
6965
blockType := v1alpha1.BlockType(blockName)
7066

7167
if serverName == "" {
68+
if m.spec.Blocks == nil {
69+
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
70+
}
71+
7272
if _, ok := m.spec.Blocks[blockType]; !ok {
7373
return NotFoundError{Msg: fmt.Sprintf("block %q not found", blockName)}
7474
}

0 commit comments

Comments
 (0)