Comparing version 1.1.0 to 1.1.1
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var MAX_LINES_COUNT, REGEXES, SPLITTER_MAX_LINES, _CRLF_to_LF, _restore_CRLF, getDelimiter, htmlPlaner, isSplitter, postprocess, preprocess, setReturnFlags; | ||
var CONTENT_CHUNK_SIZE, MAX_LINES_COUNT, MAX_LINE_LENGTH, REGEXES, SPLITTER_MAX_LINES, _CRLF_to_LF, _restore_CRLF, getDelimiter, htmlPlaner, isSplitter, postprocess, preprocess, setReturnFlags; | ||
@@ -13,2 +13,4 @@ htmlPlaner = require('./htmlPlaner'); | ||
MAX_LINE_LENGTH = 200000; | ||
exports.extractFrom = function(msgBody, contentType, dom) { | ||
@@ -132,2 +134,5 @@ if (contentType == null) { | ||
var k, len, matchArray, pattern, ref; | ||
if (line.length > MAX_LINE_LENGTH) { | ||
return null; | ||
} | ||
ref = REGEXES.SPLITTER_PATTERNS; | ||
@@ -202,3 +207,3 @@ for (k = 0, len = ref.length; k < len; k++) { | ||
}); | ||
if (contentType === 'text/plain') { | ||
if (contentType === 'text/plain' && msgBody.length < MAX_LINE_LENGTH) { | ||
msgBody = msgBody.replace(REGEXES.ON_DATE_SMB_WROTE, function(entireMatch, groupMatch1, groupMatch2, groupMatch3, groupMatch4, matchIndex) { | ||
@@ -219,7 +224,15 @@ if (matchIndex && msgBody[matchIndex - 1] !== "\n") { | ||
CONTENT_CHUNK_SIZE = 100; | ||
getDelimiter = function(msgBody) { | ||
var delmiterMatch; | ||
delmiterMatch = REGEXES.DELIMITER.exec(msgBody); | ||
if (delmiterMatch) { | ||
return delmiterMatch[0]; | ||
var bodyChunk, contentLength, currentIndex, delimiterMatch; | ||
contentLength = msgBody.length; | ||
currentIndex = 0; | ||
bodyChunk = msgBody.substr(currentIndex, CONTENT_CHUNK_SIZE); | ||
while (!(delimiterMatch = REGEXES.DELIMITER.exec(bodyChunk)) && currentIndex < contentLength) { | ||
currentIndex += CONTENT_CHUNK_SIZE; | ||
bodyChunk = msgBody.substr(currentIndex, CONTENT_CHUNK_SIZE); | ||
} | ||
if (delimiterMatch) { | ||
return delimiterMatch[0]; | ||
} else { | ||
@@ -226,0 +239,0 @@ return "\n"; |
{ | ||
"name": "planer", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Remove reply quotations from emails", | ||
@@ -32,5 +32,5 @@ "main": "lib/planer.js", | ||
"coffee-script": "^1.10.0", | ||
"jsdom": "^8.1.0", | ||
"jsdom": "^11.6.0", | ||
"mocha": "^2.3.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100081
562