Skip to content

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

Merged
andrii-bodnar merged 4 commits into
crowdin:masterfrom
pcbeingused33:fix/pr-body-quoting
Dec 3, 2026
Merged

andrii-bodnar merged 4 commits into
crowdin:masterfrom
pcbeingused33:fix/pr-body-quoting

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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: checked locally by running the production create_pull_request with curl stubbed and inspecting the JSON it sends (quotes, backslashes, a literal placeholder, real and literal \n new lines, other escapes, an empty body). On master the double-quote, backslash and escaped-quote cases fail; with this change all pass. As requested in review, that script is not part of this PR. The whole action was not run against GitHub.

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

@pcbeingused33

Copy link
Copy Markdown
Contributor 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.

@andrii-bodnar andrii-bodnar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@pcbeingused33 thanks for the fix! The entrypoint.sh change looks good.

Could you please drop tests/pull-request-payload.sh from this PR? It pulls create_pull_request out with sed and stubs curl based on its exact flags, so it would break on unrelated refactors. It also isn't wired into CI. We'd rather keep this PR to the one-line fix.

@pcbeingused33

Copy link
Copy Markdown
Contributor Author

Done, dropped tests/pull-request-payload.sh; the PR now only touches entrypoint.sh, and I updated the description to match.

This comment was drafted with Claude Code.

@andrii-bodnar
andrii-bodnar merged commit b7a4bc2 into crowdin:master Dec 3, 2026
1 check passed
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