1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

decode filename when match an urlencode filename from contentDispositionFilename

This commit is contained in:
wangsongyan 2019-07-30 11:37:10 +08:00
parent 323b2eabcf
commit c61205d980
2 changed files with 19 additions and 0 deletions

View file

@ -238,6 +238,20 @@ describe('network_utils', function() {
}
throw new Error(`Unexpected headerName: ${headerName}`);
})).toEqual('filename.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="%e4%b8%ad%e6%96%87.pdf"';
}
throw new Error(`Unexpected headerName: ${headerName}`);
})).toEqual('中文.pdf');
expect(extractFilenameFromHeader((headerName) => {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="100%.pdf"';
}
throw new Error(`Unexpected headerName: ${headerName}`);
})).toEqual('100%.pdf');
});
it('gets the filename from the response header (RFC 6266)', function() {