File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1364,6 +1364,30 @@ describe('Parse.File testing', () => {
13641364 ) ;
13651365 } ) ;
13661366
1367+ it ( 'works with a period in the file name' , async ( ) => {
1368+ await reconfigureServer ( {
1369+ fileUpload : {
1370+ enableForPublic : true ,
1371+ } ,
1372+ } ) ;
1373+ const headers = {
1374+ 'X-Parse-Application-Id' : 'test' ,
1375+ 'X-Parse-REST-API-Key' : 'rest' ,
1376+ } ;
1377+ await expectAsync (
1378+ request ( {
1379+ method : 'POST' ,
1380+ headers : headers ,
1381+ url : 'http://localhost:8378/1/files/file.png.html' ,
1382+ body : '<html></html>\n' ,
1383+ } ) . catch ( e => {
1384+ throw new Error ( e . data . error ) ;
1385+ } )
1386+ ) . toBeRejectedWith (
1387+ new Parse . Error ( Parse . Error . FILE_SAVE_ERROR , `File upload of extension html is disabled.` )
1388+ ) ;
1389+ } ) ;
1390+
13671391 it ( 'works with array' , async ( ) => {
13681392 await reconfigureServer ( {
13691393 fileUpload : {
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export class FilesRouter {
155155 } ;
156156 let extension = contentType ;
157157 if ( filename && filename . includes ( '.' ) ) {
158- extension = filename . split ( '.' ) [ 1 ] ;
158+ extension = filename . split ( '.' ) [ filename . split ( '.' ) . length - 1 ] ;
159159 } else if ( contentType && contentType . includes ( '/' ) ) {
160160 extension = contentType . split ( '/' ) [ 1 ] ;
161161 }
You can’t perform that action at this time.
0 commit comments