Skip to content

Incorrect parsing of options with escaped quotes  #484

@jettdc

Description

@jettdc

trying to parse the string:

const curl = `curl -X POST "https://api.example.com/data" -H "Content-Type: application/json" -d "{\\"key\\": \\"This string has an escaped backslash: \\\\ and a newline: \\\\n\\"}"`;

Which is equivalent to the valid curl command

curl -X POST "https://api.example.com/data" -H "Content-Type: application/json" -d "{\"key\": \"This string has an escaped backslash: \\ and a newline: \\n\"}"

But when I parse it, my args array looks like the following:

_: [
        'curl',
        'https://api.example.com/data',
        'string',
        'has',
        'an',
        'escaped',
        'backslash:',
        '\\\\',
        'and',
        'a',
        'newline:',
        '\\\\n\\"}"'
      ],

Am I missing something or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions