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', () => {
1364
1364
) ;
1365
1365
} ) ;
1366
1366
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
+
1367
1391
it ( 'works with array' , async ( ) => {
1368
1392
await reconfigureServer ( {
1369
1393
fileUpload : {
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export class FilesRouter {
155
155
} ;
156
156
let extension = contentType ;
157
157
if ( filename && filename . includes ( '.' ) ) {
158
- extension = filename . split ( '.' ) [ 1 ] ;
158
+ extension = filename . split ( '.' ) [ filename . split ( '.' ) . length - 1 ] ;
159
159
} else if ( contentType && contentType . includes ( '/' ) ) {
160
160
extension = contentType . split ( '/' ) [ 1 ] ;
161
161
}
You can’t perform that action at this time.
0 commit comments