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

@ -80,6 +80,12 @@ describe('ui_utils', function() {
expect(getPDFFileNameFromURL('/pdfs/file3.txt', '')).toEqual('');
});
it('gets fallback filename when url is not a string', function() {
expect(getPDFFileNameFromURL(null)).toEqual('document.pdf');
expect(getPDFFileNameFromURL(null, 'file.pdf')).toEqual('file.pdf');
});
it('gets PDF filename from URL containing leading/trailing whitespace',
function() {
// Relative URL