Skip to content

Conversation

@majiayu000
Copy link
Contributor

Fixes #3708

Changes

  • Add validation to check if resource name is present before executing edit command
  • Return a clear error message when resource name is missing from the path

When editing a cluster-scoped resource like Namespace, the edit command would previously run without a specific resource name if the path parsing resulted in an empty name, causing kubectl to open all resources instead of the selected one.

When editing a resource with a path that ends with "/" (e.g., "-/"),
the resource name extracted by client.Namespaced() is empty. This
caused the kubectl edit command to be constructed without a resource
name, resulting in editing ALL resources of that type instead of a
single resource.

This fix adds a check to ensure the resource name is not empty before
proceeding with the edit command. If the name is empty, an error is
returned to prevent the unintended behavior.

Fixes derailed#3708

Signed-off-by: majiayu000 <[email protected]>
@derailed
Copy link
Owner

derailed commented Jan 2, 2026

@majiayu000 Thank you for this update! Tho I don't think this fixes the issue vs just flagging the condition.
Editing a ns should always yield a path like ~/fred hence a name. I think we need more info here as I can't seem to find a valid repro.

@derailed derailed added the question Further information is requested label Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing a single Namespace opens the editor with a list of all Namespaces

2 participants