New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

front-mailparser

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

front-mailparser - npm Package Compare versions

Comparing version 0.6.1-1 to 0.6.1-2

49

lib/mailparser.js

@@ -207,3 +207,6 @@ "use strict";

if (this._remainder.length > 1048576) {
this._remainder = this._remainder.replace(/(.{1048576}(?!\r?\n|\r))/g, "$&\n");
if (this.options.fastChunking)
this._remainder = force1MbLines(this._remainder);
else
this._remainder = this._remainder.replace(/(.{1048576}(?!\r?\n|\r))/g, "$&\n");
}

@@ -261,2 +264,46 @@ }

function force1MbLines(str) {
const oneMb = 1048576;
// this used to be: str.replace(/(.{1048576}(?!\r?\n|\r))/g, "$&\n");
// but regexp performance is terrible with such long strings
// the regexp uses "x(?!y)" which means "x not followed by y"
if (str.length < oneMb)
return str;
let current = str;
const chunks = [];
// force line-breaks every 1Mb
// however, we must check if there's not already a line-break immediately afterwards
// it could cause the message to be partially imported
while (current.length >= oneMb) {
let chunk = str.substring(0, oneMb);
const rest = str.substring(oneMb);
if (rest.substring(0, 2) === '\r\n') {
// rest is \r\n...
chunk = chunk + '\r\n';
rest = rest.substring(2);
} else if (rest[0] === '\n') {
// rest is \n...
chunk = chunk + '\n';
rest = rest.substring(1);
} else if (rest[0] === '\r') {
// rest is \r...
chunk = chunk + '\r';
rest = rest.substring(1);
} else {
// otherwise, force a line-break
chunk = chunk + '\n';
}
current = rest;
chunks.push(chunk);
}
return chunks.join('');
}
/**

@@ -263,0 +310,0 @@ * <p>Processes a line while in header state</p>

2

package.json
{
"name": "front-mailparser",
"description": "Asynchronous and non-blocking parser for mime encoded e-mail messages",
"version": "0.6.1-1",
"version": "0.6.1-2",
"author": "Andris Reinman",

@@ -6,0 +6,0 @@ "maintainers": [{

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc