When the OEmbedFilter runs, it splits lines with a regular expression that will accidentally grab a character. When it joins the text back together the character is removed.

Repro Steps:
1. Create a paragraph
2. Edit as HTML
3. Paste this in

<p>
Test
X
Y
</p>

5. Save

The X and Y will be removed.

I'm not sure why it's not just splitting on \n and joining on \n. If there's a reason to grab a character before the \n then matching a space seems safe (See the attached patch). Otherwise I'd just split on \n.

CommentFileSizeAuthor
#2 3108929-oembed-filter-split-fix.patch568 bytesonedotover

Comments

onedotover created an issue. See original summary.

onedotover’s picture

StatusFileSize
new568 bytes
codebymikey’s picture

I'm still interested to know why most of the filters have been implemented as regex's rather than parsing the DOM like all of the core plugins do using an XPath query - It's less likely to run into bugs like this where the HTML is an unexpected format, and leads to more maintainable code.

thorandre’s picture

This issue has been fixed in later updates.
Tested and working.

thorandre’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.