Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

haraka-email-message

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

haraka-email-message - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

7

Changes.md

@@ -5,2 +5,8 @@

### [1.1.0] - 2022-09-14
- Do not insert banner in text attachments, #3
- chore(climate): configure code climate
### [1.0.0] - 2022-06-24

@@ -13,1 +19,2 @@

[1.0.0]: https://github.com/haraka/email-message/releases/tag/1.0.0
[1.1.0]: https://github.com/haraka/email-message/releases/tag/1.1.0

39

index.js

@@ -350,3 +350,3 @@ 'use strict';

set_banner (banners) {
this.add_filter((ct, enc, buf) => insert_banner(ct, enc, buf, banners));
this.add_filter((ct, enc, buf, cd) => insert_banner(ct, enc, buf, cd, banners));
}

@@ -453,6 +453,6 @@

_empty_filter (ct, enc) {
_empty_filter (ct, enc, cd) {
let new_buf = Buffer.from('');
this.filters.forEach(filter => {
new_buf = filter(ct, enc, new_buf) || new_buf;
new_buf = filter(ct, enc, new_buf, cd) || new_buf;
});

@@ -463,11 +463,15 @@

_emit_buf_fill () {
if (this.buf_fill > 0) {
// see below for why we create a new buffer here.
const to_emit = Buffer.alloc(this.buf_fill);
this.buf.copy(to_emit, 0, 0, this.buf_fill);
this.attachment_stream.emit_data(to_emit);
this.buf_fill = 0;
}
}
force_end () {
if (this.state === 'attachment') {
if (this.buf_fill > 0) {
// see below for why we create a new buffer here.
const to_emit = Buffer.alloc(this.buf_fill);
this.buf.copy(to_emit, 0, 0, this.buf_fill);
this.attachment_stream.emit_data(to_emit);
this.buf_fill = 0;
}
this._emit_buf_fill()
this.attachment_stream.emit_end(true);

@@ -483,9 +487,3 @@ }

if (this.state === 'attachment') {
if (this.buf_fill > 0) {
// see below for why we create a new buffer here.
const to_emit = Buffer.alloc(this.buf_fill);
this.buf.copy(to_emit, 0, 0, this.buf_fill);
this.attachment_stream.emit_data(to_emit);
this.buf_fill = 0;
}
this._emit_buf_fill()
this.attachment_stream.emit_end();

@@ -506,4 +504,5 @@ }

const cd = this.header.get_decoded('content-disposition') || '';
if (!this.body_text_encoded_pos) { // nothing to decode
return Buffer.concat([this._empty_filter(ct, enc) || Buffer.from(''), line]);
return Buffer.concat([this._empty_filter(ct, enc, cd) || Buffer.from(''), line]);
}

@@ -749,4 +748,4 @@ if (this.bodytext.length !== 0) return line; // already decoded?

function insert_banner (ct, enc, buf, banners) {
if (!banners || !/^text\//i.test(ct)) {
function insert_banner (ct, enc, buf, cd, banners) {
if (!banners || !/^text\//i.test(ct) || /^attachment/i.test(cd)) {
return;

@@ -753,0 +752,0 @@ }

{
"name": "haraka-email-message",
"version": "1.0.0",
"version": "1.1.0",
"description": "Haraka email message",

@@ -5,0 +5,0 @@ "main": "index.js",

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