Hotfix/revert script link container due to double escaping issues#338
Conversation
…ver eger themse that re apply wp kses to rendered post content
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
WalkthroughThis PR migrates the plugin's link metadata storage mechanism from JSON script tags to hidden span elements with data attributes. The backend change renders link data as a span with a 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
…ver eger themse that re apply wp kses to rendered post content
Changes proposed in this Pull Request
This pull request updates the plugin to version 1.4.1 and addresses a critical compatibility issue where link metadata was being exposed as visible text on some themes, especially when content was wrapped with
wp_kses_post. The fix involves changing how link data is embedded in post content, ensuring it is robust against multiple passes of content sanitization and remains hidden from users and the accessibility tree. Comprehensive tests are added to verify the new approach and cover edge cases.Bug fix: Compatibility with content sanitization and themes
<script>tag with raw JSON to a hidden<span>element with adata-iawmlf-linksattribute, using all JSON_HEX_* flags for encoding. This ensures the data survives multiple passes ofwp_kses_postand does not leak as visible text. The<span>is appended after the block content to avoid interfering with CSS rules. (src/WP_Post/WP_Post_Controller.php)readme.txt)Testing improvements
<span>approach works as intended, including extraction helpers, checks for the presence and correct placement of the span, survival through multiplewp_kses_postpasses, and round-tripping of special characters in URLs. (tests/WP_Post/Test_WP_Post_Controller.php) [1] [2] [3]Version bump
internet-archive-wayback-machine-link-fixer.php,package.json, andreadme.txt. [1] [2] [3] [4] [5]Testing instructions
Mentions #
Summary by CodeRabbit
Release Notes - v1.4.1