forked from mozilla/pdf.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URL annotations handled as UTF-8 to accomodate some bad PDFs. For pro…
…per 7-bit ASCII this makes no difference. Fixes Bug 1122280.
- Loading branch information
Showing
1 changed file
with
11 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
*/ | ||
/* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream, | ||
stringToBytes, assert, Promise, isArray, ObjectLoader, OperatorList, | ||
isValidUrl, OPS, createPromiseCapability, AnnotationType */ | ||
isValidUrl, OPS, createPromiseCapability, AnnotationType, | ||
stringToUTF8String */ | ||
|
||
'use strict'; | ||
|
||
|
@@ -500,7 +501,15 @@ var LinkAnnotation = (function LinkAnnotationClosure() { | |
if (!isValidUrl(url, false)) { | ||
url = ''; | ||
} | ||
data.url = url; | ||
// According to ISO 32000-1:2008, section 12.6.4.7, | ||
// URI should to be encoded in 7-bit ASCII. | ||
// Some bad PDFs may have URIs in UTF-8 encoding. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
try { | ||
data.url = stringToUTF8String(url); | ||
} catch (e) { | ||
// Fall back to a simple copy. TODO: indicate error? | ||
This comment has been minimized.
Sorry, something went wrong.
timvandermeij
|
||
data.url = url; | ||
} | ||
} else if (linkType === 'GoTo') { | ||
data.dest = action.get('D'); | ||
} else if (linkType === 'GoToR') { | ||
|
Could you add a reference to Bugzilla bug 1122280 here so that it is clear why this piece of code has been added?