Skip to content

Conversation

@edent
Copy link
Contributor

@edent edent commented Sep 21, 2023

Fixes #445

Proposed changes:

Previously, content like &lt; was incorrectly converted to < - this meant that HTML elements would be passed which wouldn't render correctly.

By removing this, I'm able to post content with encoded entities.

I've tested this on content which includes MarkDown, HTML, encoded entities, unencoded entities, etc.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Write a post which includes the literal text The new &lt;search&gt; element is <em>&quot;gr&euml;át&quot;</em> - It makes me &#x1F970; and &#128573; - you should spend your &pound;s on it.
  • Under the old version, the <search> element would be inserted and the rendering of the post would break.
  • After this patch, the entities are unchanged and the post displays as

The new <search> element is "grëát" - It makes me 🥰 and 😽 - you should spend your £s on it.

I've tested this on content which includes MarkDown, HTML, encoded entities, unencoded entities, etc.

Fixes #445
@pfefferle
Copy link
Member

I thinks we should add some tests here, to not break something else! I will also check why this was added in the first place.

@pfefferle pfefferle changed the base branch from master to fix/encoding September 29, 2023 10:49
@pfefferle pfefferle merged commit 8b3d4b1 into Automattic:fix/encoding Sep 29, 2023
@pfefferle pfefferle mentioned this pull request Sep 29, 2023
1 task
pfefferle added a commit that referenced this pull request Oct 2, 2023
* fix html-entity issue in username

* remove kses

let other platforms decide what to allow and what not

* Remove html_entity_decode to prevent encoding issues (#454)

I've tested this on content which includes MarkDown, HTML, encoded entities, unencoded entities, etc.

Fixes #445

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>

* remove allowed tags

---------

Co-authored-by: Terence Eden <edent@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrectly escaped content when using Markdown?

2 participants