File tree Expand file tree Collapse file tree
apps/web/modules/ui/components/file-input/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ describe("File Input Utils", () => {
6767 expect ( toast . error ) . toHaveBeenCalledWith ( expect . stringContaining ( "File exceeds 5 MB size limit." ) ) ;
6868 } ) ;
6969
70+ test ( "should show size error for oversized files even when mime type is empty" , async ( ) => {
71+ const files = [ new File ( [ "x" . repeat ( 101000 ) ] , "large.ico" , { type : "" } ) ] ;
72+
73+ const result = await getAllowedFiles ( files , [ "ico" ] , 0.1 ) ;
74+
75+ expect ( result ) . toHaveLength ( 0 ) ;
76+ expect ( toast . error ) . toHaveBeenCalledWith ( expect . stringContaining ( "File exceeds 0.1 MB size limit." ) ) ;
77+ } ) ;
78+
7079 test ( "should convert HEIC files to JPEG" , async ( ) => {
7180 const heicFile = new File ( [ "test" ] , "test.heic" , { type : "image/heic" } ) ;
7281 const mockConvertedFile = new File ( [ "converted" ] , "test.jpg" , { type : "image/jpeg" } ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export const getAllowedFiles = async (
2121 const convertedFiles : File [ ] = [ ] ;
2222
2323 for ( const file of files ) {
24- if ( ! file || ! file . type ) {
24+ if ( ! file ) {
2525 continue ;
2626 }
2727
You can’t perform that action at this time.
0 commit comments