Skip to content

fix: pass the pull request body to jq as data - #326

Open
pcbeingused33 wants to merge 3 commits into
crowdin:masterfrom
pcbeingused33:fix/pr-body-quoting
Open

pcbeingused33 wants to merge 3 commits into
crowdin:masterfrom
pcbeingused33:fix/pr-body-quoting

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 28, 2026 •

Copy link
Copy Markdown

A pull_request_body that contains a double quote (HTML attributes, Update "strings") makes create_pull_request fail with a jq syntax error, so no pull request is opened.

Cause: entrypoint.sh builds a "body":"..." fragment from the input and splices it into the jq program text. --arg body is passed but the filter never reads $body, so the body missed the jq sanitizing added in #202. Quotes break the program, a backslash such as C:\Users is an invalid escape, and \(...) is evaluated by jq.

Fix: the filter now reads $body and adds the body key only when it is not empty. Real new lines are kept, and a literal \n is still turned into a new line, as before. Other hand-written escapes (for example \") are no longer interpreted: they appear in the body as written, so anyone who escaped quotes to work around this can drop the backslashes.

Testing: tests/pull-request-payload.sh (Bash and jq, no network: curl is stubbed) runs the production create_pull_request and checks the JSON it sends for quotes, backslashes, a literal placeholder, real and literal \n new lines, other escapes and an empty body. On master the double-quote, backslash and escaped-quote cases fail; with this change all seven pass. The whole action was not run against GitHub.

This change was prepared with AI assistance (Claude Code).

@pcbeingused33

Copy link
Copy Markdown
Author

The follow-up adds a network-free regression for the JSON sent by the action. It covers quotes, backslashes, a literal placeholder, newline handling, and an empty body. Literal \n is still converted to a newline. Other escape sequences are preserved as written.

This comment was drafted with Claude Code.

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.

1 participant