[local-sync] Escape HTML entities in plaintext

Summary: This was understandably causing some messages to fail to display correctly.

Test Plan: unit tests are already broken for message parsing -- will fix in follow up diff

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3517
This commit is contained in:
Christine Spang 2016-12-15 09:17:45 -08:00
parent ee831ba0aa
commit ac5c7e3d2c
2 changed files with 4 additions and 1 deletions

View file

@ -11,6 +11,7 @@
"hapi-boom-decorators": "1.1.3",
"hapi-plugin-websocket": "0.9.2",
"hapi-swagger": "6.1.0",
"he": "1.1.0",
"inert": "4.0.0",
"isomorphic-core": "0.x.x",
"jasmine": "2.4.1",

View file

@ -1,6 +1,7 @@
/* eslint no-useless-escape: 0 */
const mimelib = require('mimelib');
const encoding = require('encoding');
const he = require('he');
const {Imap} = require('isomorphic-core');
const Errors = require('./errors');
@ -87,7 +88,8 @@ monospacing, but that seems OK and perhaps sometimes even desired (for e.g.
ascii art, alignment)
*/
function HTMLifyPlaintext(text) {
return `<pre class="nylas-plaintext">${text}</pre>`;
const escapedText = he.escape(text);
return `<pre class="nylas-plaintext">${escapedText}</pre>`;
}
/*