From 85f663fdb0d02827b7ab1a8d501ab9caa3fcaf49 Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Tue, 5 Aug 2014 16:34:32 -0300 Subject: Remove commented code and always sanitize mail being displayed --- web-ui/app/js/helpers/view_helper.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'web-ui/app/js/helpers/view_helper.js') diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js index 3fa9edc1..02067005 100644 --- a/web-ui/app/js/helpers/view_helper.js +++ b/web-ui/app/js/helpers/view_helper.js @@ -21,7 +21,9 @@ define( } function isQuotedPrintableBodyPart (bodyPart) { - return bodyPart.headers['Content-Transfer-Encoding'] && bodyPart.headers['Content-Transfer-Encoding'] === 'quoted-printable'; + return bodyPart.headers && + bodyPart.headers['Content-Transfer-Encoding'] && + bodyPart.headers['Content-Transfer-Encoding'] === 'quoted-printable'; } function getHtmlContentType (mail) { @@ -52,29 +54,10 @@ define( return $(getSanitizedAndDecodedMailBody(mail.getMailPartByContentType(htmlContentType))); } - return $(addParagraphsToPlainText(mail.getMailMultiParts[0])); + return $(getSanitizedAndDecodedMailBody(addParagraphsToPlainText(mail.getMailMultiParts[0]))); } - return $(addParagraphsToPlainText(mail.body)); - - /* - var body; - // probably parse MIME parts and ugliness here - // content_type: "multipart/alternative; boundary="----=_Part_1115_17865397.1370312509342"" - var mediaType = new contentType.MediaType(mail.header.content_type); - if(mediaType.type === 'multipart/alternative') { - var parsedBodyParts = getMailMultiParts(mail.body, mediaType); - var selectedBodyPart = getHtmlMailPart(parsedBodyParts) || getPlainTextMailPart(parsedBodyParts) || parsedBodyParts[0]; - body = selectedBodyPart.body; - - if (isQuotedPrintableBodyPart(selectedBodyPart)) { - body = quotedPrintable.decode(body); - } - } else { - body = addParagraphsToPlainText(mail.body); - } - return $(htmlWhitelister.sanitize(body, htmlWhitelister.tagPolicy)); - */ + return $(getSanitizedAndDecodedMailBody(addParagraphsToPlainText(mail.body))); } function moveCaretToEnd(el) { -- cgit v1.2.3