Add tests for file names with spaces and semicolons
This commit is contained in:
parent
2f19d9d906
commit
911659cd70
@ -174,11 +174,29 @@ describe('network_utils', function() {
|
|||||||
}
|
}
|
||||||
})).toEqual('filename.pdf');
|
})).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) => {
|
expect(extractFilenameFromHeader((headerName) => {
|
||||||
if (headerName === 'Content-Disposition') {
|
if (headerName === 'Content-Disposition') {
|
||||||
return 'attachment; filename=filename.pdf';
|
return 'attachment; filename=filename.pdf';
|
||||||
}
|
}
|
||||||
})).toEqual('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() {
|
it('gets the filename from the response header (RFC 6266)', function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user