mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16: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
|
@ -61,6 +61,11 @@ function extractFilenameFromHeader(getResponseHeader) {
|
|||
const contentDisposition = getResponseHeader('Content-Disposition');
|
||||
if (contentDisposition) {
|
||||
let filename = getFilenameFromContentDispositionHeader(contentDisposition);
|
||||
if (filename.includes('%')) {
|
||||
try {
|
||||
filename = decodeURIComponent(filename);
|
||||
} catch (ex) {}
|
||||
}
|
||||
if (/\.pdf$/i.test(filename)) {
|
||||
return filename;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue