URL annotations handled as UTF-8 to accommodate some bad PDFs. For proper 7-bit ASCII this makes no difference. Fixes Bug 1122280.
This commit is contained in:
parent
1a3310d537
commit
a61a4b18cc
@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
/* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream,
|
/* globals PDFJS, Util, isDict, isName, stringToPDFString, warn, Dict, Stream,
|
||||||
stringToBytes, assert, Promise, isArray, ObjectLoader, OperatorList,
|
stringToBytes, assert, Promise, isArray, ObjectLoader, OperatorList,
|
||||||
isValidUrl, OPS, createPromiseCapability, AnnotationType */
|
isValidUrl, OPS, createPromiseCapability, AnnotationType,
|
||||||
|
stringToUTF8String */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -500,7 +501,15 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
|||||||
if (!isValidUrl(url, false)) {
|
if (!isValidUrl(url, false)) {
|
||||||
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, see Bugzilla 1122280.
|
||||||
|
try {
|
||||||
|
data.url = stringToUTF8String(url);
|
||||||
|
} catch (e) {
|
||||||
|
// Fall back to a simple copy.
|
||||||
data.url = url;
|
data.url = url;
|
||||||
|
}
|
||||||
} else if (linkType === 'GoTo') {
|
} else if (linkType === 'GoTo') {
|
||||||
data.dest = action.get('D');
|
data.dest = action.get('D');
|
||||||
} else if (linkType === 'GoToR') {
|
} else if (linkType === 'GoToR') {
|
||||||
|
Loading…
Reference in New Issue
Block a user