@@ -18,7 +18,8 @@ import {
1818 ConflictException ,
1919 Injectable ,
2020 NotFoundException ,
21- OnModuleInit , UnsupportedMediaTypeException ,
21+ OnModuleInit ,
22+ UnsupportedMediaTypeException ,
2223} from '@nestjs/common' ;
2324import { InjectRepository } from '@nestjs/typeorm' ;
2425import jwt from 'jsonwebtoken' ;
@@ -792,7 +793,10 @@ export class FileService implements OnModuleInit {
792793
793794 logger . debug ( `Creating temporary access for file: ${ filename } ` ) ;
794795
795- const fileExtensionToFileTypeMap : ReadonlyMap < string , FileType > = new Map ( [
796+ const fileExtensionToFileTypeMap : ReadonlyMap <
797+ string ,
798+ FileType
799+ > = new Map ( [
796800 [ '.bag' , FileType . BAG ] ,
797801 [ '.mcap' , FileType . MCAP ] ,
798802 [ '.yaml' , FileType . YAML ] ,
@@ -801,17 +805,28 @@ export class FileService implements OnModuleInit {
801805 [ '.db3' , FileType . DB3 ] ,
802806 ] ) ;
803807
804- const supported_file_endings = [ ...fileExtensionToFileTypeMap . keys ( ) ] ;
808+ const supported_file_endings = [
809+ ...fileExtensionToFileTypeMap . keys ( ) ,
810+ ] ;
805811
806- if ( ! supported_file_endings . some ( ( ending ) => filename . endsWith ( ending ) ) ) {
812+ if (
813+ ! supported_file_endings . some ( ( ending ) =>
814+ filename . endsWith ( ending ) ,
815+ )
816+ ) {
807817 emptyCredentials . error = 'Invalid file ending' ;
808818 return emptyCredentials ;
809819 }
810820
811- const matchingFileType = supported_file_endings . find ( ending => filename . endsWith ( ending ) ) ;
812- if ( matchingFileType === undefined ) throw new UnsupportedMediaTypeException ( ) ;
813- const fileType : FileType | undefined = fileExtensionToFileTypeMap . get ( matchingFileType ) ;
814- if ( fileType === undefined ) throw new UnsupportedMediaTypeException ( ) ;
821+ const matchingFileType = supported_file_endings . find ( ( ending ) =>
822+ filename . endsWith ( ending ) ,
823+ ) ;
824+ if ( matchingFileType === undefined )
825+ throw new UnsupportedMediaTypeException ( ) ;
826+ const fileType : FileType | undefined =
827+ fileExtensionToFileTypeMap . get ( matchingFileType ) ;
828+ if ( fileType === undefined )
829+ throw new UnsupportedMediaTypeException ( ) ;
815830
816831 // check if file already exists
817832 const existingFile = await this . fileRepository . exists ( {
0 commit comments