rusackas opened a new pull request, #34512:
URL: https://github.com/apache/superset/pull/34512
### SUMMARY
This PR fixes an issue where strings containing angle brackets (e.g.,
`<abcdef:12345>`) were not displaying in SQL Lab query results.
The root cause was that the `isProbablyHTML` function was too aggressive in
detecting HTML content. It would treat any string that created DOM elements
when parsed as HTML, even if those elements were unknown/custom tags. This
caused strings like `<abcdef:12345>` to be rendered using
`dangerouslySetInnerHTML`, which browsers ignore for unknown tags, making the
content disappear.
**Changes:**
- Enhanced `isProbablyHTML` to check against a whitelist of known HTML tags
- Added early return if the string doesn't match common HTML patterns
- Added comprehensive test cases for various edge cases
Fixes #25561
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before:** Strings like `<abcdef:12345>` would not display in query results
**After:** These strings now display correctly as plain text
### TESTING INSTRUCTIONS
1. Go to SQL Lab
2. Run a query that returns strings with angle brackets:
```sql
SELECT '<abcdef:12345>' as test_str
UNION ALL
SELECT '<foo:bar>' as test_str
UNION ALL
SELECT 'normal text' as test_str
UNION ALL
SELECT '<div>actual html</div>' as test_str
```
3. Verify that:
- `<abcdef:12345>` and `<foo:bar>` display as plain text
- `normal text` displays normally
- `<div>actual html</div>` still renders as HTML (maintaining existing
functionality)
### ADDITIONAL INFORMATION
- [x] Has associated issue: #25561
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.ai/code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]