Skip to content

fix(request-snippets): escape pipe character in cURL CMD snippets#10770

Open
ceykiii wants to merge 1 commit intoswagger-api:masterfrom
ceykiii:fix/cmd-pipe-escape
Open

fix(request-snippets): escape pipe character in cURL CMD snippets#10770
ceykiii wants to merge 1 commit intoswagger-api:masterfrom
ceykiii:fix/cmd-pipe-escape

Conversation

@ceykiii
Copy link
Copy Markdown

@ceykiii ceykiii commented Mar 16, 2026

Summary

Escape the vertical bar | character in cURL CMD request snippets to prevent CMD from interpreting it as a pipe operator.

Problem

When a request body contains the | character, the generated CMD curl snippet does not escape it. CMD interprets | as a pipe operator, causing the command to fail with an error.

Fix

Added .replace(/\|/g, "^|") to the escapeCMD function in src/core/plugins/request-snippets/fn.js. The caret ^ is the standard CMD escape character.

Fixes #10540

…pets

The pipe character `|` was not escaped in the CMD curl snippet generator,
causing CMD to interpret it as a command pipe operator when the request
body contained `|` characters.

Fixed by adding `.replace(/\|/g, "^|")` to the escapeCMD function,
which escapes the pipe with the CMD escape character `^`.

Fixes swagger-api#10540
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.

Vertical bar character | is not escaped in cURL (CMD) request snipped body

1 participant