Skip to content

cURL globbing error for brackets #305

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

Closed
tconrado opened this issue Jul 11, 2020 · 2 comments
Closed

cURL globbing error for brackets #305

tconrado opened this issue Jul 11, 2020 · 2 comments

Comments

@tconrado
Copy link

Decription

cURL will fail if in the URL there are nested brackets "{" or "}" as it was not escape neither the -g option set
eg. https://my.restdb.io/rest/users?q={"orderInfo":{"$elemMatch":{"userID":3366129827943}}}

To Reproduce

  1. Create a get request
  2. Use any http that has "{" and "}"
    https://my.restdb.io/rest/users?q={"orderInfo":{"$elemMatch":{"userID":3366129827943}}}
  3. Copy the code for cURL
    curl -X GET 'https://my.restdb.io/rest/users?q={%22orderInfo%22:{%22$elemMatch%22:{%22userID%22:3366129827943}}}' -H 'apikey: 5bd08e5ac19ba11113b50dad' -H 'x-apikey: 5bd08e5ac19ba11113b50dad'
  4. Run on Bash
  5. Get the error
    curl: (3) [globbing] nested brace in column 52

To fix

Detect nested braces in the URL and add the option "-g" to cURL or escape braces as "{"

curl -g -X GET 'https://my.restdb.io/rest/users?q={%22orderInfo%22:{%22$elemMatch%22:{%22userID%22:3366129827943}}}' -H 'apikey: 5bd08e5ac19ba11113b50dad' -H 'x-apikey: 5bd08e5ac19ba11113b50dad'

or

curl -X GET 'https://my.restdb.io/rest/users?q={%22orderInfo%22:\{%22$elemMatch%22:\{%22userID%22:3366129827943\}\}}' -H 'apikey: 5bd08e5ac19ba11113b50dad' -H 'x-apikey: 5bd08e5ac19ba11113b50dad'

@someshkoli
Copy link
Contributor

Possible duplicate #253
PR: #258
Also curl breaks only when there are nested {{}} or [[]]

@umeshp7
Copy link
Contributor

umeshp7 commented Oct 21, 2020

duplicates #253

@umeshp7 umeshp7 closed this as completed Oct 21, 2020
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

No branches or pull requests

3 participants