1
0
Fork 0
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:
Jonas Jenwald 2018-09-30 12:22:50 +02:00
parent 6da78bcc3f
commit 1c814e208e
2 changed files with 9 additions and 0 deletions

View file

@ -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.');