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

rfc2047

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc2047 - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

6

lib/rfc2047.js

@@ -223,2 +223,3 @@ /* global unescape */

let previousTokenWasEncodedWord = false; // Consecutive encoded words must have a space between them, so this state must be kept
let nextTokenMustBeEncoded = false;
let previousTokenWasWhitespaceFollowingEncodedWord = false;

@@ -229,3 +230,3 @@ let result = '';

let token = tokens[i];
if (unsafeTokenRegExp.test(token)) {
if (unsafeTokenRegExp.test(token) || (token && nextTokenMustBeEncoded)) {
const matchQuotesAtBeginning = token.match(/^"+/);

@@ -251,2 +252,3 @@ if (matchQuotesAtBeginning) {

if (token.length > maxNumCharsPerEncodedWord) {
nextTokenMustBeEncoded = true;
const chars = [...token];

@@ -259,2 +261,4 @@ tokens.splice(

token = chars.slice(0, maxNumCharsPerEncodedWord).join('');
} else {
nextTokenMustBeEncoded = false;
}

@@ -261,0 +265,0 @@

2

package.json
{
"name": "rfc2047",
"version": "4.0.0",
"version": "4.0.1",
"description": "Encode and decode rfc2047 (MIME encoded words)",

@@ -5,0 +5,0 @@ "main": "lib/rfc2047.js",

@@ -67,2 +67,10 @@ const unexpected = require('unexpected');

it('should handle single word encoding, containing one non ASCII-character', () => {
expect(
'ABCDE-München <abcde-muenchen@example.org>',
'to encode back and forth to',
'=?utf-8?Q?ABCDE-M=C3=BC?= =?utf-8?Q?nchen?= <abcde-muenchen@example.org>'
);
});
it('should use an UTF-8 encoded word when a character is not in iso-8859-1', () => {

@@ -142,3 +150,3 @@ expect(

'to encode back and forth to',
'=?utf-8?Q?test=5F=EF=BF=BD=2Ed?=ocx'
'=?utf-8?Q?test=5F=EF=BF=BD=2Ed?= =?utf-8?Q?ocx?='
);

@@ -145,0 +153,0 @@ });

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