1515// limitations under the License.
1616
1717import axios , { AxiosRequestConfig } from 'axios' ;
18- import Busboy from 'busboy' ;
18+ import Busboy , { BusboyHeaders } from 'busboy' ;
1919import { Request } from 'express' ;
2020import { promises as fs } from 'fs' ;
2121import { X509 } from 'jsrsasign' ;
@@ -54,7 +54,7 @@ export const fileExists = async (filePath: string): Promise<boolean> => {
5454 try {
5555 const stats = await fs . stat ( filePath ) ;
5656 return ! stats . isDirectory ( ) ;
57- } catch ( err ) {
57+ } catch ( err : any ) {
5858 if ( err . errno === - 2 ) {
5959 return false ;
6060 } else {
@@ -67,7 +67,7 @@ export const fileExists = async (filePath: string): Promise<boolean> => {
6767export const extractFileFromMultipartForm = ( req : Request ) : Promise < IFile > => {
6868 return new Promise ( async ( resolve , reject ) => {
6969 let fileFound = false ;
70- req . pipe ( new Busboy ( { headers : req . headers } )
70+ req . pipe ( new Busboy ( { headers : req . headers as BusboyHeaders } )
7171 . on ( 'file' , ( fieldname , readableStream , fileName ) => {
7272 fileFound = true ;
7373 resolve ( {
@@ -86,7 +86,7 @@ export const extractFileFromMultipartForm = (req: Request): Promise<IFile> => {
8686export const extractMessageFromMultipartForm = ( req : Request ) : Promise < string > => {
8787 return new Promise ( async ( resolve , reject ) => {
8888 let fieldFound = false ;
89- req . pipe ( new Busboy ( { headers : req . headers } )
89+ req . pipe ( new Busboy ( { headers : req . headers as BusboyHeaders } )
9090 . on ( 'field' , ( fieldname , value ) => {
9191 if ( fieldname === 'message' ) {
9292 fieldFound = true ;
@@ -107,7 +107,7 @@ export const axiosWithRetry = async (config: AxiosRequestConfig) => {
107107 try {
108108 log . debug ( `${ config . method } ${ config . url } ` ) ;
109109 return await axios ( config ) ;
110- } catch ( err ) {
110+ } catch ( err : any ) {
111111 const data = err . response ?. data ;
112112 log . error ( `${ config . method } ${ config . url } attempt ${ attempts } [${ err . response ?. status } ]` , ( data && ! data . on ) ? data : err . stack ) ;
113113 if ( err . response ?. status === 404 ) {
0 commit comments