From 9a9d2c801c68e9cb35adc4570b89bfa133342147 Mon Sep 17 00:00:00 2001 From: Jacob Bare Date: Wed, 3 Apr 2019 09:16:45 -0500 Subject: [PATCH] Do not decode html entities Ensures that embedded images (and the like) do not break. When decoding, an embed would be incorrectly processed as: ```html
%{[ data-embed-type="image" data-embed-id="5c9cebaadad15fb329dd5219" data-embed-element="aside" contenteditable="false" ]}%
``` When decoding is disabled, the embed is processed as expected: ```html
%{[ data-embed-type="image" data-embed-id="5c9cebaadad15fb329dd5219" data-embed-element="aside" contenteditable="false" ]}%
``` This holds true for other HTML entities that are always being decoded by Base. --- src/rules/pennwell/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/pennwell/default.js b/src/rules/pennwell/default.js index c580ba8..f3a19e6 100644 --- a/src/rules/pennwell/default.js +++ b/src/rules/pennwell/default.js @@ -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($);