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

Fixed an issue where certain character after $ were omitted while importing curl #74

Closed
wants to merge 3 commits into from

Conversation

aman-v-singh
Copy link
Contributor

Overview

Fix for the issue:- postmanlabs/postman-app-support#11888

The user was unable to import the string below correctly:-
curl -X GET "https://alextest.com/" -H "5f005074: [jKanrLih$!]SooCV5u)aI!pt9"
The output is coming out to be

{
  method: 'GET',
  name: 'https://alextest.com',
  url: 'https://alextest.com',
  header: [ { key: '5f005074', value: '[jKanrLih$!SooCV5u)aI!pt9' } ],
  body: {},
  description: 'Generated from a curl request: \n' +
    'curl -X GET \\"https://alextest.com\\" -H \\"5f005074: [jKanrLih$!]SooCV5u)aI!pt9\\"'
}

As you can see the character ] is missing in the header value.

RCA

When a curl string has $ char, and the next character matches /[*@#?$!_\-]/, the character after that skipped because the index was incremented seemingly unnecessarily.

Fix

Remove unnecessary index increment.

Output

The output after fix is correct and as expected.

{
  method: 'GET',
  name: 'https://alextest.com',
  url: 'https://alextest.com',
  header: [ { key: '5f005074', value: '[jKanrLih$!]SooCV5u)aI!pt9' } ],
  body: {},
  description: 'Generated from a curl request: \n' +
    'curl -X GET \\"https://alextest.com\\" -H \\"5f005074: [jKanrLih$!]SooCV5u)aI!pt9\\"'
}

Copy link
Member

@VShingala VShingala left a comment

Choose a reason for hiding this comment

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

Let's add unit test for this fix as well.

assets/shell-quote.js Show resolved Hide resolved
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