mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Merge pull request #7749 from Snuffleupagus/PDFLinkService_setHash-dest-fallback
Avoid accidentally rejecting a named destination that looks like a decimal number or a boolean (PR 7341 follow-up)
This commit is contained in:
commit
e94c2945af
1 changed files with 6 additions and 0 deletions
|
@ -264,6 +264,12 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
|
||||||
dest = unescape(hash);
|
dest = unescape(hash);
|
||||||
try {
|
try {
|
||||||
dest = JSON.parse(dest);
|
dest = JSON.parse(dest);
|
||||||
|
|
||||||
|
if (!(dest instanceof Array)) {
|
||||||
|
// Avoid incorrectly rejecting a valid named destination, such as
|
||||||
|
// e.g. "4.3" or "true", because `JSON.parse` converted its type.
|
||||||
|
dest = dest.toString();
|
||||||
|
}
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
|
|
||||||
if (typeof dest === 'string' || isValidExplicitDestination(dest)) {
|
if (typeof dest === 'string' || isValidExplicitDestination(dest)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue