File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ describe('toFile()', () => {
61
61
}
62
62
} ) ;
63
63
64
+ it ( 'sets the {type} from extension regardless of case' , ( ) => {
65
+ const types = Array . from ( COMMON_MIME_TYPES . values ( ) ) ;
66
+ const files = Array . from ( COMMON_MIME_TYPES . keys ( ) )
67
+ . map ( key => key . toUpperCase ( ) )
68
+ . map ( ext => new File ( [ ] , `test.${ ext } ` ) )
69
+ . map ( f => toFileWithPath ( f ) ) ;
70
+
71
+ for ( const file of files ) {
72
+ expect ( types . includes ( file . type ) ) . toBe ( true ) ;
73
+ }
74
+ } ) ;
75
+
64
76
it ( 'clones the File' , ( ) => {
65
77
const opts : FilePropertyBag = {
66
78
type : 'application/json' ,
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ function withMimeType(file: File) {
34
34
35
35
if ( name && hasExtension && ! file . type ) {
36
36
const ext = name . split ( '.' )
37
- . pop ( ) ! ;
37
+ . pop ( ) ! . toLowerCase ( ) ;
38
38
const type = COMMON_MIME_TYPES . get ( ext ) ;
39
39
if ( type ) {
40
40
return clone ( file , type ) ;
You can’t perform that action at this time.
0 commit comments