Skip to content

fix: preserve case of label selectors in command prompt - #4276

Merged
uozalp merged 1 commit into
derailed:masterfrom
kevin9327:fix/label-selector-case
Oct 7, 2026
Merged

uozalp merged 1 commit into
derailed:masterfrom
kevin9327:fix/label-selector-case

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

Kubernetes label keys and values are case-sensitive, but the command interpreter lowercases the label selector argument before it is parsed. As a result, a prompt such as

:pods app=MyApp

ends up as the selector app=myapp and matches nothing when the pods are labeled app=MyApp. The same happens for quoted set-based selectors ('app in (MyApp,Other)') and for selectors coming from aliases. This is the remaining part of #2855 (which was auto-closed as stale).

The fix stops lowercasing the label argument in newArgs. The command name, namespace, filter and fuzzy arguments keep their existing case handling.

Tests: added two mixed-case cases to TestLabelCmd (plain and quoted set-based selectors). Both fail on master (app=myapp,tier=backend / app in (myapp,other)) and pass with the change. The existing l-arg-caps case expected FRED=BLEE to become fred=blee, which is exactly the behavior being fixed, so I updated it to expect the case to be preserved. go test ./internal/... and go vet pass.

@uozalp uozalp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevin9327 thanks for fixing this bug

@uozalp
uozalp merged commit edb1c48 into derailed:master Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants