File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -1364,6 +1364,34 @@ describe('Parse.File testing', () => {
13641364 ) ;
13651365 } ) ;
13661366
1367+ it ( 'allows file without extension' , async ( ) => {
1368+ await reconfigureServer ( {
1369+ fileUpload : {
1370+ enableForPublic : true ,
1371+ fileExtensions : [ '^[^hH][^tT][^mM][^lL]?$' ] ,
1372+ } ,
1373+ } ) ;
1374+ const headers = {
1375+ 'X-Parse-Application-Id' : 'test' ,
1376+ 'X-Parse-REST-API-Key' : 'rest' ,
1377+ } ;
1378+
1379+ const values = [ 'filenamewithoutextension' ] ;
1380+
1381+ for ( const value of values ) {
1382+ await expectAsync (
1383+ request ( {
1384+ method : 'POST' ,
1385+ headers : headers ,
1386+ url : `http://localhost:8378/1/files/${ value } ` ,
1387+ body : '<html></html>\n' ,
1388+ } ) . catch ( e => {
1389+ throw new Error ( e . data . error ) ;
1390+ } )
1391+ ) . toBeResolved ( ) ;
1392+ }
1393+ } ) ;
1394+
13671395 it ( 'works with array' , async ( ) => {
13681396 await reconfigureServer ( {
13691397 fileUpload : {
Original file line number Diff line number Diff line change @@ -159,9 +159,9 @@ export class FilesRouter {
159159 } else if ( contentType && contentType . includes ( '/' ) ) {
160160 extension = contentType . split ( '/' ) [ 1 ] ;
161161 }
162- extension = extension . split ( ' ' ) . join ( '' ) ;
162+ extension = extension ? .split ( ' ' ) ? .join ( '' ) ;
163163
164- if ( ! isValidExtension ( extension ) ) {
164+ if ( extension && ! isValidExtension ( extension ) ) {
165165 next (
166166 new Parse . Error (
167167 Parse . Error . FILE_SAVE_ERROR ,
You can’t perform that action at this time.
0 commit comments