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

@lbu/server

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lbu/server - npm Package Compare versions

Comparing version 0.0.62 to 0.0.63

11

package.json
{
"name": "@lbu/server",
"version": "0.0.62",
"version": "0.0.63",
"description": "Koa server and common middleware",

@@ -19,4 +19,4 @@ "main": "./index.js",

"dependencies": {
"@lbu/insight": "0.0.62",
"@lbu/stdlib": "0.0.62",
"@lbu/insight": "0.0.63",
"@lbu/stdlib": "0.0.63",
"formidable": "2.0.0-canary.20200504.1",

@@ -26,4 +26,3 @@ "keygrip": "1.1.0",

"koa-body": "4.2.0",
"koa-session": "6.0.0",
"qs": "6.9.4"
"koa-session": "6.0.0"
},

@@ -51,3 +50,3 @@ "maintainers": [

},
"gitHead": "1cf32f25700229a1c20488776304a4c05884d88e"
"gitHead": "a2a6732381f5b0a3460336afd90d611c6ba4447c"
}
import { AppError } from "@lbu/stdlib";
import formidable from "formidable";
import koaBody from "koa-body";
import qs from "qs";

@@ -11,3 +10,4 @@ /**

* @param {IKoaBodyOptions} [bodyOpts={}] Options that will be passed to koa-body
* @param {IFormidableBodyOptions} [multipartBodyOpts={}] Options that will be passed to formidable
* @param {IFormidableBodyOptions} [multipartBodyOpts={}] Options that will be passed to
* formidable
* @returns {BodyParserPair}

@@ -30,3 +30,4 @@ */

*
* Source; https://github.com/node-formidable/formidable/blob/master/src/Formidable.js#L103
* Source;
* https://github.com/node-formidable/formidable/blob/master/src/Formidable.js#L103
*

@@ -48,17 +49,4 @@ * @param {IFormidableBodyOptions} opts

let mockFields = "";
const fields = {};
const files = {};
// skips query string conversion for object/array
// types, since this is done in the apiClient
form.on("field", (name, value) => {
// check if object
if (value.indexOf("&") === 0) {
mockFields = `${mockFields}&${value}`;
} else {
const mObj = { [name]: value };
mockFields = `${mockFields}&${qs.stringify(mObj)}`;
}
});
form.on("file", (name, file) => {

@@ -75,11 +63,9 @@ if (Object.prototype.hasOwnProperty.call(files, name)) {

form.on("error", (err) => {
reject(AppError.serverError({ fields, files }, err));
reject(AppError.serverError({ files }, err));
});
form.on("end", () => {
Object.assign(fields, qs.parse(mockFields));
resolve({ fields, files });
resolve({ files });
});
form.parse(ctx.req);
}).then(({ fields, files }) => {
ctx.request.body = fields;
}).then(({ files }) => {
ctx.request.files = files;

@@ -86,0 +72,0 @@ return next();

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