[Pkg-javascript-commits] [pdf.js] 10/106: URL annotations handled as UTF-8 to accommodate some bad PDFs. For proper 7-bit ASCII this makes no difference. Fixes Bug 1122280.
David Prévot
taffit at moszumanska.debian.org
Sat Jun 20 21:33:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit a61a4b18cc4b195c7109e9f4673c840f3852e47a
Author: Martin Heller <hellemar at fel.cvut.cz>
Date: Mon May 11 00:46:59 2015 +0200
URL annotations handled as UTF-8 to accommodate some bad PDFs. For proper 7-bit ASCII this makes no difference. Fixes Bug 1122280.
---
src/core/annotation.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/core/annotation.js b/src/core/annotation.js
index bd4fed8..32974b5 100644
--- a/src/core/annotation.js
+++ b/src/core/annotation.js
@@ -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, see Bugzilla 1122280.
+ try {
+ data.url = stringToUTF8String(url);
+ } catch (e) {
+ // Fall back to a simple copy.
+ data.url = url;
+ }
} else if (linkType === 'GoTo') {
data.dest = action.get('D');
} else if (linkType === 'GoToR') {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list