diff options
-rw-r--r-- | web-ui/app/js/helpers/view_helper.js | 18 | ||||
-rw-r--r-- | web-ui/test/spec/helpers/view_helper.spec.js | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js index bb909cea..22ab1324 100644 --- a/web-ui/app/js/helpers/view_helper.js +++ b/web-ui/app/js/helpers/view_helper.js @@ -35,30 +35,30 @@ define( return textPlainBody.replace(/^(.*?)$/mg, '<p>$1</p>'); } - function escapeHtmlTags (body) { + function escapeHtmlTags(body) { var escapeIndex = { - "&": "&", - "<": "<", - ">": ">", + '&': '&', + '<': '<', + '>': '>', '"': '"', - "'":''', - "/": '/' + '\'':''', + '/': '/' }; return body.replace(/["'<>\/&]/g, function(char){ return escapeIndex[char]; - } ) + }); } - function escapeHtmlAndAddParagraphs (body) { + function escapeHtmlAndAddParagraphs(body) { var escapedBody = escapeHtmlTags(body); return addParagraphsToPlainText(escapedBody); } - function formatMailBody (mail) { + function formatMailBody(mail) { var body = mail.htmlBodyPart ? htmlWhitelister.sanitize(mail.htmlBody, htmlWhitelister.tagPolicy) : escapeHtmlAndAddParagraphs(mail.textPlainBody); diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index b975dcd9..d84cb4ac 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -63,9 +63,9 @@ define(['helpers/view_helper'], function (viewHelper) { it('escape html in plain text body', function () { var formattedMail = $('<div></div>'); var mail = testData.parsedMail.simpleTextPlain; - mail.textPlainBody = '<font color="red">This is some text!</font>' + mail.textPlainBody = '<font color="red">This is some text!</font>'; formattedMail.html(viewHelper.formatMailBody(mail)); - expect(formattedMail.text()).toBe('<font color="red">This is some text!</font>') + expect(formattedMail.text()).toBe('<font color="red">This is some text!</font>'); }); |