What Operating System are you using (both controller, and any agents involved in the problem)?
Linux
Reproduction steps
Run a Jenkins build with this pipeline script:
node {
String googleWebhook = 'https://chat.googleapis.com/v1/spaces/your-url-here'
String message = 'The plugin does not handle double quotes: " '
googlechatnotification message: message, url: googleWebhook;
}
Expected Results
Should send a chat message.
Actual Results
The Jenkins build log shows that the string sent to the API is improperly quoted, and the Google API returns "Invalid JSON payload"
[Pipeline] googlechatnotification
Send Google Chat Notification condition is : true
Final formatted text: { "text": "The plugin does not handle double quotes: " "}
Google Chat post may have failed. Response: {
"error": {
"code": 400,
"message": "Invalid JSON payload received. Expected , or } after key:value pair.\nle double quotes: \" \"}\n ^",
"status": "INVALID_ARGUMENT"
}
}
, Response Code: 400
Anything else?
The plugin's escapeSpecialCharacter function escapes some characters, but not double quotes. (It escapes single quotes, but probably doesn't need to. JSON strings are always double quoted.) Better would be to use a library function like groovy.json.JsonBuilder's toString(), replacing this code in send()
Jenkins and plugins versions report
Environment
```text Paste the output here ```What Operating System are you using (both controller, and any agents involved in the problem)?
Linux
Reproduction steps
Run a Jenkins build with this pipeline script:
Expected Results
Should send a chat message.
Actual Results
The Jenkins build log shows that the string sent to the API is improperly quoted, and the Google API returns "Invalid JSON payload"
Anything else?
The plugin's
escapeSpecialCharacter
function escapes some characters, but not double quotes. (It escapes single quotes, but probably doesn't need to. JSON strings are always double quoted.) Better would be to use a library function like groovy.json.JsonBuilder's toString(), replacing this code in send()with something like this:
and removing use of
replaceJenkinsKeywords
increateTextMessage()
.