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

fix(html-sanitize): Sanitize HTML comments in PR #4285

Merged
merged 2 commits into from
Aug 14, 2019

Conversation

rakeshtembhurne
Copy link
Contributor

Sanitizes HTML comments inside PR body for BitBucket server.

Closes #3715

@rakeshtembhurne rakeshtembhurne force-pushed the feat/html-sanitize branch 2 times, most recently from 281ff7a to 577f81f Compare August 14, 2019 05:03
@@ -964,6 +964,7 @@ export function getPrBody(input: string) {
.replace(/<\/?summary>/g, '**')
.replace(/<\/?details>/g, '')
.replace(new RegExp(`\n---\n\n.*?<!-- .*?-rebase -->.*?(\n|$)`), '')
.replace(new RegExp('<!--.*-->', 'g'), '')
Copy link
Member

@viceice viceice Aug 14, 2019

Choose a reason for hiding this comment

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

Shouldn't we be non greedy here '<!--.*?-->' ?

otherwise we would replace all:

<!-- comment -->
Text
<!-- other comment -->
Suggested change
.replace(new RegExp('<!--.*-->', 'g'), '')
.replace(new RegExp('<!--.*?-->', 'g'), '')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right. I will make sure that it works well with such scenarios as well.

Copy link
Member

Choose a reason for hiding this comment

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

I've added the suggestion. if you like you can take it 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a good suggestion. Happy to use it.

Sanitizes HTML comments inside PR body for BitBucket server.
Includes snapshots for the tests.

Refer renovatebot#3715
@rarkins rarkins merged commit 4ee030a into renovatebot:master Aug 14, 2019
@renovate-bot
Copy link
Collaborator

🎉 This PR is included in version 19.24.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rakeshtembhurne rakeshtembhurne deleted the feat/html-sanitize branch August 14, 2019 19:58
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sanitize all HTML comments on Bitbucket/Bitbucket Server
4 participants