Skip to content

Commit e3a7c07

Browse files
committed
Fix the broken regular expression in the decode helper in the getPdfFilenameFromUrl function (issue 20664)
This will ignore filenames that become effectively empty, i.e. ones that are only ".pdf" and nothing more. *Please note:* While this passes all existing unit-tests, I don't know if this is necessarily the "correct" solution here.
1 parent 218a687 commit e3a7c07

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/display/display_utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,9 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
377377
let decoded = decodeURIComponent(name);
378378
if (decoded.includes("/")) {
379379
decoded = stripPath(decoded);
380-
if (decoded.test(/^\.pdf$/i)) {
381-
return decoded;
380+
if (/^\.pdf$/i.test(decoded)) {
381+
return name;
382382
}
383-
return name;
384383
}
385384
return decoded;
386385
} catch {

0 commit comments

Comments
 (0)