mirror of
https://github.com/thelounge/thelounge.git
synced 2026-03-14 14:35:50 +01:00
chore(deps): update @fastify/busboy to v3
Proper type for `BusboyFileStream` (fastify/busboy#51).
This commit is contained in:
parent
5cfb6882a6
commit
00a44c52ad
3 changed files with 14 additions and 29 deletions
|
|
@ -55,7 +55,7 @@
|
|||
"./public/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^1.2.1",
|
||||
"@fastify/busboy": "^3.2.0",
|
||||
"bcryptjs": "^3.0.3",
|
||||
"chalk": "^4.1.2",
|
||||
"cheerio": "~1.0.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Config from "../config";
|
||||
import busboy, {BusboyHeaders} from "@fastify/busboy";
|
||||
import busboy, {BusboyFileStream, BusboyHeaders} from "@fastify/busboy";
|
||||
import {v4 as uuidv4} from "uuid";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
|
@ -234,19 +234,7 @@ class Uploader {
|
|||
|
||||
busboyInstance.on(
|
||||
"file",
|
||||
(
|
||||
fieldname: any,
|
||||
fileStream: {
|
||||
on: (
|
||||
arg0: string,
|
||||
arg1: {(err: any): Response<any, Record<string, any>>; (): void}
|
||||
) => void;
|
||||
unpipe: (arg0: any) => void;
|
||||
read: {bind: (arg0: any) => any};
|
||||
pipe: (arg0: any) => void;
|
||||
},
|
||||
filename: string | number | boolean
|
||||
) => {
|
||||
(fieldname: string, fileStream: BusboyFileStream, filename: string) => {
|
||||
uploadUrl = `${randomName}/${encodeURIComponent(filename)}`;
|
||||
|
||||
if (Config.values.fileUpload.baseUrl) {
|
||||
|
|
@ -257,17 +245,21 @@ class Uploader {
|
|||
|
||||
// if the busboy data stream errors out or goes over the file size limit
|
||||
// abort the processing with an error
|
||||
// @ts-expect-error Argument of type '(err: any) => Response<any, Record<string, any>>' is not assignable to parameter of type '{ (err: any): Response<any, Record<string, any>>; (): void; }'.ts(2345)
|
||||
fileStream.on("error", abortWithError);
|
||||
fileStream.on("limit", () => {
|
||||
fileStream.unpipe(streamWriter);
|
||||
if (streamWriter) {
|
||||
fileStream.unpipe(streamWriter);
|
||||
}
|
||||
|
||||
fileStream.on("readable", fileStream.read.bind(fileStream));
|
||||
|
||||
return abortWithError(Error("File size limit reached"));
|
||||
});
|
||||
|
||||
// Attempt to write the stream to file
|
||||
fileStream.pipe(streamWriter);
|
||||
if (streamWriter) {
|
||||
fileStream.pipe(streamWriter);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
15
yarn.lock
15
yarn.lock
|
|
@ -1275,12 +1275,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.1.tgz#de633db3ec2ef6a3c89e2f19038063e8a122e2c2"
|
||||
integrity sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==
|
||||
|
||||
"@fastify/busboy@^1.2.1":
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-1.2.1.tgz#9c6db24a55f8b803b5222753b24fe3aea2ba9ca3"
|
||||
integrity sha512-7PQA7EH43S0CxcOa9OeAnaeA0oQ+e/DHNPZwSQM9CQHW76jle5+OvLdibRp/Aafs9KXbLhxyjOTkRjWUbQEd3Q==
|
||||
dependencies:
|
||||
text-decoding "^1.0.0"
|
||||
"@fastify/busboy@^3.2.0":
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-3.2.0.tgz#13ed8212f3b9ba697611529d15347f8528058cea"
|
||||
integrity sha512-m9FVDXU3GT2ITSe0UaMA5rU3QkfC/UXtCU8y0gSN/GugTqtVldOBWIB5V6V3sbmenVZUIpU6f+mPEO2+m5iTaA==
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.1.0":
|
||||
version "7.1.0"
|
||||
|
|
@ -7972,11 +7970,6 @@ test-exclude@^6.0.0:
|
|||
glob "^7.1.4"
|
||||
minimatch "^3.0.4"
|
||||
|
||||
text-decoding@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/text-decoding/-/text-decoding-1.0.0.tgz#38a5692d23b5c2b12942d6e245599cb58b1bc52f"
|
||||
integrity sha512-/0TJD42KDnVwKmDK6jj3xP7E2MG7SHAOG4tyTgyUCRPdHwvkquYNLEQltmdMa3owq3TkddCVcTsoctJI8VQNKA==
|
||||
|
||||
text-table@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue