Skip to content
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

importWxr: Preserve backslashes in the imported content #1213

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Apr 8, 2024

What is this PR doing?

Preserves the backslashes in the content imported through importWxr by calling wp_slash on the entire imported data.

This issue started after the recent switch to the humanmade/wordpress-importer in #1192. Turns out that importer doesn't call wp_slash on its own.

Closes #1211

Testing Instructions

Confirm the unit tests pass.

cc @aplamada @dmsnell

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Feature] Import Export labels Apr 8, 2024
@adamziel adamziel merged commit 790a3b6 into trunk Apr 8, 2024
5 checks passed
@adamziel adamziel deleted the wxr-import-fix-utf8-characters branch April 8, 2024 13:39

const expectedPostContent = `<!-- wp:inseri-core/text-editor {"blockId":"DSrQIjN5UjosCHJQImF5z","blockName":"textEditor","height":60,"content":"\\u0022#test\\u0022","contentType":"application/json"} -->
<div class="wp-block-inseri-core-text-editor" data-attributes="{&quot;blockId&quot;:&quot;DSrQIjN5UjosCHJQImF5z&quot;,&quot;blockName&quot;:&quot;textEditor&quot;,&quot;content&quot;:&quot;\\&quot;#test\\&quot;&quot;,&quot;contentType&quot;:&quot;application/json&quot;,&quot;editable&quot;:false,&quot;height&quot;:60,&quot;isVisible&quot;:true,&quot;label&quot;:&quot;&quot;}">is loading ...</div>
<!-- /wp:inseri-core/text-editor -->`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that these are encoding tests, I could see some value in storing this in a file as well. it seems like you properly encoded \\u0022 so that it turns into \u0022, but it's easy to get lost quickly in the levels of encoding and display

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, that's a good point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Import Export [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue in importing WXR files
2 participants