mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-14 17:24:04 +02:00
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.
This commit is contained in:
parent
218a687a3b
commit
e3a7c0779d
@ -377,10 +377,9 @@ function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
|
||||
let decoded = decodeURIComponent(name);
|
||||
if (decoded.includes("/")) {
|
||||
decoded = stripPath(decoded);
|
||||
if (decoded.test(/^\.pdf$/i)) {
|
||||
return decoded;
|
||||
if (/^\.pdf$/i.test(decoded)) {
|
||||
return name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
return decoded;
|
||||
} catch {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user