-
Notifications
You must be signed in to change notification settings - Fork 156
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 issue 889 - Unicode characters not escaped #890
Conversation
Fixes the issue with Unicode characters in block attributes not escaped and getting stripped out during syndication
@amalajith Thanks for the PR! I made a few formatting changes but otherwise looks good. But a couple things that may improve this a bit:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, should we also wrap post_content with wp_slash for non-gutenberg content?
distributor/includes/classes/InternalConnections/NetworkSiteConnection.php
Lines 72 to 80 in aa36d6c
$new_post_args = array( | |
'post_title' => html_entity_decode( get_the_title( $post_id ), ENT_QUOTES, get_bloginfo( 'charset' ) ), | |
'post_name' => $post->post_name, | |
'post_content' => Utils\get_processed_content( $post->post_content ), | |
'post_excerpt' => $post->post_excerpt, | |
'post_type' => $post->post_type, | |
'post_author' => isset( $post->post_author ) ? $post->post_author : get_current_user_id(), | |
'post_status' => 'publish', | |
); |
Yeah, I think having it for both is probably the way to go, as long as that doesn't have any unintended consequences. And as mentioned in my comment, if we move this code to the |
It shouldn't have any consequences, WP expects the following to be slashed and unslashes it within
I wasn't able to reproduce the bug using external connections, so either the data is being slashed there already or this bug doesn't affect both connection types. I was using this mini-plugin for testing -- it needs to be active on all sites & creates a test post on each site test-block.zip |
I've done some additional testing locally. I think I'll move the slashing to include the entire post object rather than just the content. This will ensure the bug is fixed in it's entirety rather than risk the same bug appearing in other fields, such as title. |
Description of the Change
Add slashes to the post content to fixe the issue with Unicode characters in block attributes not escaped and getting stripped out during syndication
Closes #889
Alternate Designs
Possible Drawbacks
Verification Process
After adding the
wp_slash()
, the syndicated content has properly escaped slashes in the Unicode characters and the content is now properly rendered.Checklist:
Changelog Entry
Credits
Props @