-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: escape arguments containing spaces #982
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
@@ -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)); |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
...ages/web/src/components/pages/Tests/TestDetails/TestSettings/SettingsVariables/Arguments.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Fixes
How to test it
screenshots
Checklist