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: escape arguments containing spaces #982

Merged
merged 15 commits into from
Jan 5, 2024

Conversation

topliceanurazvan
Copy link
Member

@topliceanurazvan topliceanurazvan commented Jan 4, 2024

Fixes

How to test it

  • Check escaped arguments from YAML specification

screenshots

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Copy link

vercel bot commented Jan 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
testkube-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2024 11:55am

@@ -28,6 +28,10 @@ import {prettifyArguments} from '@utils/prettifyArguments';

import {ArgumentsWrapper} from './Arguments.styled';

const formatArgsArray = (args: string[]) => {
return args.map(arg => (arg.includes(' ') ? `"${arg}"` : arg));
Copy link
Member

Choose a reason for hiding this comment

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

Missing escaping of " inside.

args:
- 'abc" def'

will become invalid "abc" def" instead of "abc\" def"

Copy link
Member

@rangoo94 rangoo94 Jan 5, 2024

Choose a reason for hiding this comment

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

Additionally, it should escape quotes even when there is no space, otherwise:

args:
- 'abc"def'

will become abc"def instead of abc\"def

Copy link
Member

Choose a reason for hiding this comment

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

Plus, it should check for any kind of space /\s/.test(arg)

Copy link
Member

Choose a reason for hiding this comment

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

We could as well just use external library for quoting, like shell-quote

Copy link
Member

@rangoo94 rangoo94 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@topliceanurazvan topliceanurazvan merged commit e202f8f into develop Jan 5, 2024
13 checks passed
@topliceanurazvan topliceanurazvan deleted the razvantopliceanu/fix/escaped-test-arguments branch January 5, 2024 12:07
@github-actions github-actions bot mentioned this pull request Jan 23, 2024
4 tasks
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