mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 18:25:37 +02:00
Handle undefined url in LinkAnnotation
This commit is contained in:
parent
35f5a1ea5e
commit
054f1e7e57
1 changed files with 2 additions and 2 deletions
|
@ -644,7 +644,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
||||||
if (isName(url)) {
|
if (isName(url)) {
|
||||||
// Some bad PDFs do not put parentheses around relative URLs.
|
// Some bad PDFs do not put parentheses around relative URLs.
|
||||||
url = '/' + url.name;
|
url = '/' + url.name;
|
||||||
} else {
|
} else if (url) {
|
||||||
url = addDefaultProtocolToUrl(url);
|
url = addDefaultProtocolToUrl(url);
|
||||||
}
|
}
|
||||||
// TODO: pdf spec mentions urls can be relative to a Base
|
// TODO: pdf spec mentions urls can be relative to a Base
|
||||||
|
@ -684,7 +684,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
||||||
|
|
||||||
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
|
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
|
||||||
function addDefaultProtocolToUrl(url) {
|
function addDefaultProtocolToUrl(url) {
|
||||||
if (url.indexOf('www.') === 0) {
|
if (url && url.indexOf('www.') === 0) {
|
||||||
return ('http://' + url);
|
return ('http://' + url);
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue