-
Notifications
You must be signed in to change notification settings - Fork 52
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
[WIP] feat/489: Add Rewrite Tone feature #803
base: develop
Are you sure you want to change the base?
Conversation
blocks.map( ( { clientId, content } ) => { | ||
return { | ||
clientId, | ||
content: content.replace( /<!--[\s\S]*?-->/g, '' ), |
Check failure
Code scanning / CodeQL
Incomplete multi-character sanitization High
<!--
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to ensure that all instances of the targeted pattern are removed, even if they are nested or malformed. One effective way to achieve this is to apply the regular expression replacement repeatedly until no more replacements can be performed. This approach ensures that all occurrences of the pattern are removed, leaving no unsafe content behind.
We will modify the removeDelimiters
function to repeatedly apply the regular expression replacement until the content no longer changes. This will ensure that all HTML comment delimiters are removed from the content.
-
Copy modified lines R204-R208 -
Copy modified line R211
@@ -203,5 +203,10 @@ | ||
blocks.map( ( { clientId, content } ) => { | ||
let previous; | ||
do { | ||
previous = content; | ||
content = content.replace( /<!--[\s\S]*?-->/g, '' ); | ||
} while (content !== previous); | ||
return { | ||
clientId, | ||
content: content.replace( /<!--[\s\S]*?-->/g, '' ), | ||
content, | ||
}; |
Description of the Change
Closes #
How to test the Change
Changelog Entry
Credits
Props @username, @username2, ...
Checklist: