Skip to content

Commit

Permalink
Do not decode html entities
Browse files Browse the repository at this point in the history
Ensures that embedded images (and the like) do not break.

When decoding, an embed would be incorrectly processed as:
```html
<center>%{[ data-embed-type=&quot;image&quot; data-embed-id=&quot;5c9cebaadad15fb329dd5219&quot; data-embed-element=&quot;aside&quot; contenteditable=&quot;false&quot; ]}%</center>
```

When decoding is disabled, the embed is processed as expected:
```html
<center>%{[ data-embed-type="image" data-embed-id="5c9cebaadad15fb329dd5219" data-embed-element="aside" contenteditable="false" ]}%</center>
```

This holds true for other HTML entities that are always being decoded by Base.
  • Loading branch information
zarathustra323 committed Apr 3, 2019
1 parent e330aa7 commit 9a9d2c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/pennwell/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const extractAuthor = ($) => {

module.exports = async (body) => {
const html = (body || '').replace(/\s\s+/g, '');
const $ = cheerio.load(html);
const $ = cheerio.load(html, { decodeEntities: false });

const deck = extractDeck($);
const author = extractAuthor($);
Expand Down

0 comments on commit 9a9d2c8

Please sign in to comment.