From 8e4b5e50dcfbca51e5897d159f37c118515ee7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Sun, 28 Jan 2024 11:28:54 +0100 Subject: [PATCH] use @fastify/busboy v2.1.0 (#506) * use busboy2 * busboy2 --- index.js | 12 ++++++++++-- package.json | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 1c5c53f1..d5526f59 100644 --- a/index.js +++ b/index.js @@ -199,8 +199,16 @@ function fastifyMultipart (fastify, options, done) { const parts = () => { return new Promise((resolve, reject) => { handle((val) => { - if (val instanceof Error) return reject(val) - resolve(val) + if (val instanceof Error) { + if (val.message === 'Unexpected end of multipart data') { + // Stop parsing without throwing an error + resolve(null) + } else { + reject(val) + } + } else { + resolve(val) + } }) }) } diff --git a/package.json b/package.json index a7fc3343..0236f55f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "type": "commonjs", "types": "types/index.d.ts", "dependencies": { - "@fastify/busboy": "^1.0.0", + "@fastify/busboy": "^2.1.0", "@fastify/deepmerge": "^1.0.0", "@fastify/error": "^3.0.0", "fastify-plugin": "^4.0.0",