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:
parent
323b2eabcf
commit
c61205d980
2 changed files with 19 additions and 0 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue