diff --git a/bower.json b/bower.json index e8dbbdcc4..762d07eda 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.3.152", + "version": "1.3.154", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 2788b4173..f18206fb9 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { typeof global !== 'undefined' ? global : this).PDFJS = {}; } -PDFJS.version = '1.3.152'; -PDFJS.build = '96d8b8f'; +PDFJS.version = '1.3.154'; +PDFJS.build = '4399d01'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -9972,6 +9972,16 @@ var XRefParseException = (function XRefParseExceptionClosure() { return XRefParseException; })(); +var NullCharactersRegExp = /\x00/g; + +function removeNullCharacters(str) { + if (typeof str !== 'string') { + warn('The argument for removeNullCharacters must be a string.'); + return str; + } + return str.replace(NullCharactersRegExp, ''); +} +PDFJS.removeNullCharacters = removeNullCharacters; function bytesToString(bytes) { assert(bytes !== null && typeof bytes === 'object' && @@ -11150,6 +11160,7 @@ exports.log2 = log2; exports.readInt8 = readInt8; exports.readUint16 = readUint16; exports.readUint32 = readUint32; +exports.removeNullCharacters = removeNullCharacters; exports.shadow = shadow; exports.string32 = string32; exports.stringToBytes = stringToBytes; @@ -15527,6 +15538,7 @@ var AnnotationType = sharedUtil.AnnotationType; var Util = sharedUtil.Util; var isExternalLinkTargetSet = sharedUtil.isExternalLinkTargetSet; var LinkTargetStringMap = sharedUtil.LinkTargetStringMap; +var removeNullCharacters = sharedUtil.removeNullCharacters; var warn = sharedUtil.warn; var CustomStyle = displayDOMUtils.CustomStyle; @@ -15726,7 +15738,8 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() { this.container.className = 'linkAnnotation'; var link = document.createElement('a'); - link.href = link.title = this.data.url || ''; + link.href = link.title = (this.data.url ? + removeNullCharacters(this.data.url) : ''); if (this.data.url && isExternalLinkTargetSet()) { link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; diff --git a/build/pdf.js b/build/pdf.js index 66b93bfcf..f907f71a0 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { typeof global !== 'undefined' ? global : this).PDFJS = {}; } -PDFJS.version = '1.3.152'; -PDFJS.build = '96d8b8f'; +PDFJS.version = '1.3.154'; +PDFJS.build = '4399d01'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -607,6 +607,16 @@ var XRefParseException = (function XRefParseExceptionClosure() { return XRefParseException; })(); +var NullCharactersRegExp = /\x00/g; + +function removeNullCharacters(str) { + if (typeof str !== 'string') { + warn('The argument for removeNullCharacters must be a string.'); + return str; + } + return str.replace(NullCharactersRegExp, ''); +} +PDFJS.removeNullCharacters = removeNullCharacters; function bytesToString(bytes) { assert(bytes !== null && typeof bytes === 'object' && @@ -1785,6 +1795,7 @@ exports.log2 = log2; exports.readInt8 = readInt8; exports.readUint16 = readUint16; exports.readUint32 = readUint32; +exports.removeNullCharacters = removeNullCharacters; exports.shadow = shadow; exports.string32 = string32; exports.stringToBytes = stringToBytes; @@ -1807,6 +1818,7 @@ var AnnotationType = sharedUtil.AnnotationType; var Util = sharedUtil.Util; var isExternalLinkTargetSet = sharedUtil.isExternalLinkTargetSet; var LinkTargetStringMap = sharedUtil.LinkTargetStringMap; +var removeNullCharacters = sharedUtil.removeNullCharacters; var warn = sharedUtil.warn; var CustomStyle = displayDOMUtils.CustomStyle; @@ -2006,7 +2018,8 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() { this.container.className = 'linkAnnotation'; var link = document.createElement('a'); - link.href = link.title = this.data.url || ''; + link.href = link.title = (this.data.url ? + removeNullCharacters(this.data.url) : ''); if (this.data.url && isExternalLinkTargetSet()) { link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 6a0d42d89..dcd6c4753 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { typeof global !== 'undefined' ? global : this).PDFJS = {}; } -PDFJS.version = '1.3.152'; -PDFJS.build = '96d8b8f'; +PDFJS.version = '1.3.154'; +PDFJS.build = '4399d01'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -9904,6 +9904,16 @@ var XRefParseException = (function XRefParseExceptionClosure() { return XRefParseException; })(); +var NullCharactersRegExp = /\x00/g; + +function removeNullCharacters(str) { + if (typeof str !== 'string') { + warn('The argument for removeNullCharacters must be a string.'); + return str; + } + return str.replace(NullCharactersRegExp, ''); +} +PDFJS.removeNullCharacters = removeNullCharacters; function bytesToString(bytes) { assert(bytes !== null && typeof bytes === 'object' && @@ -11082,6 +11092,7 @@ exports.log2 = log2; exports.readInt8 = readInt8; exports.readUint16 = readUint16; exports.readUint32 = readUint32; +exports.removeNullCharacters = removeNullCharacters; exports.shadow = shadow; exports.string32 = string32; exports.stringToBytes = stringToBytes; diff --git a/package.json b/package.json index 5c09284cc..f20fd65ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.3.152", + "version": "1.3.154", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 18995dbf7..73516708c 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -34,12 +34,6 @@ var MAX_AUTO_SCALE = 1.25; var SCROLLBAR_PADDING = 40; var VERTICAL_PADDING = 5; -var NullCharactersRegExp = /\x00/g; - -function removeNullCharacters(str) { - return str.replace(NullCharactersRegExp, ''); -} - function getFileName(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?');