Conversation
…heses format Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| // XML tag neutralization - convert XML tags to parentheses format | ||
| sanitized = convertXmlTagsToParentheses(sanitized); | ||
|
|
||
| // XML character escaping for remaining characters |
There was a problem hiding this comment.
Removed XML character escaping for &, ", and ' characters as requested. These characters now remain unescaped while XML tags continue to be converted to parentheses format. (6530724)
| // XML tag neutralization - convert XML tags to parentheses format | ||
| sanitized = convertXmlTagsToParentheses(sanitized); | ||
|
|
||
| // XML character escaping for remaining characters |
There was a problem hiding this comment.
Removed XML character escaping for &, ", and ' characters as requested. These characters now remain unescaped while XML tags continue to be converted to parentheses format. (6530724)
…ving XML tag conversion Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| return ( | ||
| s | ||
| // Standard XML tags: <tag>, <tag attr="value">, <tag/>, </tag> | ||
| .replace(/<\/?[a-zA-Z][a-zA-Z0-9\-_:]*(?:\s+[^>]*)?>/g, match => { |
There was a problem hiding this comment.
@copilot review regex and make sure all allowed white space patterns are handled. Review again and again.
There was a problem hiding this comment.
Reviewed and fixed the regex to handle all whitespace patterns correctly. The issue was that the pattern (?:\s+[^>]*)? required at least one whitespace character before attributes, causing self-closing tags like <br/> to be missed while <br /> worked fine.
Fixed regex: (?:\s[^>]*|\/)? now handles:
- ✅ Self-closing without space:
<br/>,<img src="test.jpg"/> - ✅ Self-closing with space:
<br />,<img src="test.jpg" /> - ✅ Various whitespace: tabs, newlines, multiple spaces
- ✅ Regular tags:
<div>,</div>,<div class="test">
Added comprehensive test coverage and verified all existing functionality remains intact. (c54bf99)
- Changed regex from `(?:\s+[^>]*)? ` to `(?:\s[^>]*|\/)?` in both compute_text.cjs and sanitize_output.cjs - Now correctly handles self-closing tags without whitespace (e.g., `<br/>`, `<img src="test.jpg"/>`) - Supports all whitespace patterns: spaces, tabs, newlines in any quantity - Added comprehensive tests for self-closing tags and various whitespace patterns - Preserves mathematical operators and maintains security by converting XML tags to parentheses format Fixes issue where tags like `<tag/>` were not being converted while `<tag />` worked correctly. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
compute_text.cjsandsanitize_output.cjs(?:\s+[^>]*)?to(?:\s[^>]*|\/)?to handle:<br/>,<img src="test.jpg"/><br />,<img src="test.jpg" /><div>,</div>,<div class="test">✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.