mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Recognize file name in reference fragment in getPDFFileNameFromURL
The regular expression incorrectly marked a group as capturing. For `http://example.com/#file.pdf`, the expected result is "file.pdf", but instead "document.pdf" was returned.
This commit is contained in:
parent
6f0cf8c4cb
commit
5fdc908f02
1 changed files with 2 additions and 2 deletions
|
@ -371,8 +371,8 @@ function noContextMenuHandler(e) {
|
|||
* @return {String} Guessed PDF file name.
|
||||
*/
|
||||
function getPDFFileNameFromURL(url) {
|
||||
var reURI = /^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
|
||||
// SCHEME HOST 1.PATH 2.QUERY 3.REF
|
||||
var reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
|
||||
// SCHEME HOST 1.PATH 2.QUERY 3.REF
|
||||
// Pattern to get last matching NAME.pdf
|
||||
var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
|
||||
var splitURI = reURI.exec(url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue