Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic displaying invoked command #98

Merged
merged 1 commit into from
May 31, 2024
Merged

Fix panic displaying invoked command #98

merged 1 commit into from
May 31, 2024

Conversation

dadgar
Copy link
Collaborator

@dadgar dadgar commented May 28, 2024

Changes proposed in this PR:

When the command recieves an error because the authentication token expired and wasn't able to be refreshed, we display a help error informing the user to logout, login, and re-run the command.

A panic was occuring if the previous command had escaped quoted inputs, since the string was being directly added to a template that itself had quotes. This was causing the template string to become invalid, and then rendering the template would error.

This commit causes the command to be properly escaped before it is injected into the template.

How I've tested this PR:

Added a test that failed before the change, and now works. Also caused the new error message to be displayed for every command being run to verify no more panics.

How I expect reviewers to test this PR:

Does the code logic look correct.

Checklist:

  • Tests added if applicable
  • CHANGELOG entry added or label 'pr/no-changelog' added to PR

    Run CHANGELOG_PR=<PR number> make changelog/new-entry for guidance
    in authoring a changelog entry, and commit the resulting file, which should
    have a name matching your PR number. Entries should use imperative present
    tense (e.g. Add support for...)

When the command recieves an error because the authentication token
expired and wasn't able to be refreshed, we display a help error
informing the user to logout, login, and re-run the command.

A panic was occuring if the previous command had escaped quoted inputs,
since the string was being directly added to a template that itself had
quotes. This was causing the template string to become invalid, and then
rendering the template would error.

This commit causes the command to be properly escaped before it is
injected into the template.
@dadgar dadgar force-pushed the b-command-escaping branch from 4b02f9e to f2b21ff Compare May 28, 2024 22:49
@dadgar dadgar marked this pull request as ready for review May 28, 2024 22:50
@dadgar dadgar requested a review from a team as a code owner May 28, 2024 22:50
Copy link
Member

@jasonpilz jasonpilz left a comment

Choose a reason for hiding this comment

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

LGTM

@dadgar dadgar merged commit 4570a18 into main May 31, 2024
6 checks passed
@dadgar dadgar deleted the b-command-escaping branch May 31, 2024 17:26
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.

3 participants