@@ -176,12 +176,12 @@ function isImage(buffer: Buffer): boolean {
176176}
177177
178178export async function uploadScreenshots ( ctx : Context ) : Promise < void > {
179- const allowedExtensions = ctx . options . fileExtension . map ( ext => ext . trim ( ) . toLowerCase ( ) ) ;
179+ const allowedExtensions = ctx . options . fileExtension . map ( ext => `. ${ ext . trim ( ) . toLowerCase ( ) } ` ) ;
180180 const ignorePatterns = ctx . options . ignorePattern . map ( pattern => pattern . trim ( ) . toLowerCase ( ) ) ;
181181 let noOfScreenshots = 0 ;
182182
183183 async function processDirectory ( directory : string , relativePath : string = '' ) : Promise < void > {
184- let files = fs . readdirSync ( directory ) ;
184+ const files = fs . readdirSync ( directory ) ;
185185
186186 for ( let file of files ) {
187187 const filePath = path . join ( directory , file ) ;
@@ -196,7 +196,7 @@ export async function uploadScreenshots(ctx: Context): Promise<void> {
196196 if ( stat . isDirectory ( ) ) {
197197 await processDirectory ( filePath , relativeFilePath ) ; // Recursively process subdirectory
198198 } else {
199- let fileExtension = path . extname ( file ) . toLowerCase ( ) . slice ( 1 ) ;
199+ let fileExtension = path . extname ( file ) . toLowerCase ( ) ;
200200 if ( allowedExtensions . includes ( fileExtension ) ) {
201201 const fileBuffer = fs . readFileSync ( filePath ) ;
202202
@@ -207,7 +207,7 @@ export async function uploadScreenshots(ctx: Context): Promise<void> {
207207
208208 let ssId = relativeFilePath ;
209209 if ( ctx . options . stripExtension ) {
210- ssId = path . join ( relativePath , path . basename ( file , path . extname ( file ) ) ) ;
210+ ssId = path . join ( relativePath , path . basename ( file , fileExtension ) ) ;
211211 }
212212
213213 let viewport = 'default' ;
0 commit comments