Add tests for file names with spaces and semicolons

This commit is contained in:
Rob Wu 2018-02-04 17:58:10 +01:00
parent 2f19d9d906
commit 911659cd70

View File

@ -174,11 +174,29 @@ describe('network_utils', function() {
}
})).toEqual('filename.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="filename.pdf and spaces.pdf"';
}
})).toEqual('filename.pdf and spaces.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="tl;dr.pdf"';
}
})).toEqual('tl;dr.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename=filename.pdf';
}
})).toEqual('filename.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename=filename.pdf someotherparam';
}
})).toEqual('filename.pdf');
});
it('gets the filename from the response header (RFC 6266)', function() {