Socket
Socket
Sign inDemoInstall

multiparty

Package Overview
Dependencies
6
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.7 to 3.2.8

6

CHANGELOG.md

@@ -0,1 +1,7 @@

### 3.2.8
* Fix developer accidentally corrupting data
* Fix handling epilogue in a separate chunk
* Fix initial check errors to use supplied callback
### 3.2.7

@@ -2,0 +8,0 @@

73

index.js

@@ -87,6 +87,36 @@ exports.Form = Form;

// if the user supplies a callback, this implies autoFields and autoFiles
if (cb) {
// if the user supplies a callback, this implies autoFields and autoFiles
self.autoFields = true;
self.autoFiles = true;
var fields = {};
var files = {};
self.on('error', function(err) {
if (called) return;
called = true;
if (waitend && req.readable) {
// dump rest of request
req.resume();
req.once('end', function() {
cb(err);
});
return;
}
cb(err);
});
self.on('field', function(name, value) {
var fieldsArray = fields[name] || (fields[name] = []);
fieldsArray.push(value);
});
self.on('file', function(name, file) {
var filesArray = files[name] || (files[name] = []);
filesArray.push(file);
});
self.on('close', function() {
cb(null, fields, files);
});
}

@@ -104,2 +134,10 @@

var state = req._readableState;
if (req._decoder || (state && (state.encoding || state.decoder))) {
// this is a binary protocol
// if an encoding is set, input is likely corrupted
handleError(new Error('request encoding must not be set'));
return;
}
var contentType = req.headers['content-type'];

@@ -133,34 +171,2 @@ if (!contentType) {

if (cb) {
var fields = {};
var files = {};
self.on('error', function(err) {
if (called) return;
called = true;
if (waitend && req.readable) {
// dump rest of request
req.resume();
req.once('end', function() {
cb(err);
});
return;
}
cb(err);
});
self.on('field', function(name, value) {
var fieldsArray = fields[name] || (fields[name] = []);
fieldsArray.push(value);
});
self.on('file', function(name, file) {
var filesArray = files[name] || (files[name] = []);
filesArray.push(file);
});
self.on('close', function() {
cb(null, fields, files);
});
}
function onReqAborted() {

@@ -373,3 +379,2 @@ waitend = false;

self.onParsePartEnd();
self.end();
state = END;

@@ -376,0 +381,0 @@ } else if (index > 1) {

{
"name": "multiparty",
"version": "3.2.7",
"version": "3.2.8",
"description": "multipart/form-data parser which supports streaming",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc