remove unused 'body' var; use a finally
to clean up the temporary textfilter
This commit is contained in:
parent
92435c0865
commit
1c30640a92
1 changed files with 21 additions and 17 deletions
|
@ -136,12 +136,13 @@ module.exports = {
|
|||
|
||||
var isHtml = (content.format === "org.matrix.custom.html");
|
||||
|
||||
var safeBody, body;
|
||||
var safeBody;
|
||||
if (isHtml) {
|
||||
// XXX: We sanitize the HTML whilst also highlighting its text nodes, to avoid accidentally trying
|
||||
// to highlight HTML tags themselves. However, this does mean that we don't highlight textnodes which
|
||||
// are interrupted by HTML tags (not that we did before) - e.g. foo<span/>bar won't get highlighted
|
||||
// by an attempt to search for 'foobar'. Then again, the search query probably wouldn't work either
|
||||
try {
|
||||
if (highlights && highlights.length > 0) {
|
||||
var highlighter = new Highlighter(isHtml, "mx_EventTile_searchHighlight", opts.onHighlightClick);
|
||||
var safeHighlights = highlights.map(function(highlight) {
|
||||
|
@ -158,7 +159,10 @@ module.exports = {
|
|||
};
|
||||
}
|
||||
safeBody = sanitizeHtml(content.formatted_body, sanitizeHtmlParams);
|
||||
}
|
||||
finally {
|
||||
delete sanitizeHtmlParams.textFilter;
|
||||
}
|
||||
return <span className="markdown-body" dangerouslySetInnerHTML={{ __html: safeBody }} />;
|
||||
} else {
|
||||
safeBody = content.body;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue