mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Prevent getPDFFileNameFromURL
from breaking if the url
parameter is not a string
This commit is contained in:
parent
6da78bcc3f
commit
1c814e208e
2 changed files with 9 additions and 0 deletions
|
@ -548,6 +548,9 @@ function isDataSchema(url) {
|
|||
* @returns {string} Guessed PDF filename.
|
||||
*/
|
||||
function getPDFFileNameFromURL(url, defaultFilename = 'document.pdf') {
|
||||
if (typeof url !== 'string') {
|
||||
return defaultFilename;
|
||||
}
|
||||
if (isDataSchema(url)) {
|
||||
console.warn('getPDFFileNameFromURL: ' +
|
||||
'ignoring "data:" URL for performance reasons.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue