Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated stripHTML() and test to remove the whole head from html string

  • Loading branch information...
commit e7d6479f7661dc8937045ce4d4f465c2801e7a4d 1 parent 9964a79
RGBboy authored
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/helpers.js
  2. +1 −1  test/nodemailer.js
View
4 lib/helpers.js
@@ -21,8 +21,8 @@ module.exports.stripHTML = stripHTML;
function stripHTML(str){
str = (str || "").toString("utf-8").trim();
- // remove style
- str = str.replace(/<style[\s\S]{1,}?\/style>/gi, '');
+ // remove head
+ str = str.replace(/<head[\s\S]{1,}?\/head>/gi, '');
// replace newlines
str = str.replace(/\r?\n|\r/g,"-\u0002\u0002-");
View
2  test/nodemailer.js
@@ -12,7 +12,7 @@ exports["General tests"] = {
"stripHTML": function(test){
- var html = "<style>h1{color:#fe57a1}</style><h1>Tere &raquo;</h1><ul><li>Test</li></ul>",
+ var html = "<html><head><title>Title</title><style>h1{color:#fe57a1}</style></head><body><h1>Tere &raquo;</h1><ul><li>Test</li></ul></body></html>",
output = "Tere »\n======\n\n * Test";
test.equal(stripHTML(html).trim(), output);
Please sign in to comment.
Something went wrong with that request. Please try again.