Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip comments from message body payloads #1185

Merged
merged 2 commits into from
Apr 28, 2022
Merged

Conversation

WilliamBZA
Copy link
Member

@WilliamBZA WilliamBZA commented Apr 26, 2022

Fixes #1184

Removes comments of the style:

// comment
/* comment */

from the body of messages that are received from ServiceControl so that they can be rendered correctly.

This will also remove comments from XML messages as they are sent to SP as JSON anyway and will be subject to the same problems.

I don't know that this is testable given the reliance on angularjs as the $http wrapper.

method: 'GET',
transformResponse: function(defaults, transform) {
// Remove any comments from the body before deserializing
return defaults.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, function (m, g) { return g ? "" : m });
Copy link
Member

Choose a reason for hiding this comment

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

OH MY GOD

Copy link
Member Author

Choose a reason for hiding this comment

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

here

@WilliamBZA WilliamBZA merged commit 9bfd692 into master Apr 28, 2022
@WilliamBZA WilliamBZA deleted the remove-comments branch April 28, 2022 06:25
WilliamBZA added a commit that referenced this pull request Feb 17, 2023
Strip comments from message body payloads
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.

JSON bodies with comments are not displayed
2 participants