diff --git a/bower.json b/bower.json index e4b742672..26563580c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.149", + "version": "1.1.151", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index c4aa48711..83d9fea0d 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.149'; -PDFJS.build = '3f3fb1e'; +PDFJS.version = '1.1.151'; +PDFJS.build = '07af86c'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -973,6 +973,10 @@ function stringToUTF8String(str) { return decodeURIComponent(escape(str)); } +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} + function isEmptyObj(obj) { for (var key in obj) { return false; @@ -16005,6 +16009,14 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() { var fileIdBytes = stringToBytes(fileId); var passwordBytes; if (password) { + if (revision === 6) { + try { + password = utf8StringToString(password); + } catch (ex) { + warn('CipherTransformFactory: ' + + 'Unable to convert UTF8 encoded password.'); + } + } passwordBytes = stringToBytes(password); } @@ -16109,7 +16121,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() { CipherTransformFactory.prototype = { createCipherTransform: - function CipherTransformFactory_createCipherTransform(num, gen) { + function CipherTransformFactory_createCipherTransform(num, gen) { if (this.algorithm === 4 || this.algorithm === 5) { return new CipherTransform( buildCipherConstructor(this.cf, this.stmf, diff --git a/build/pdf.js b/build/pdf.js index 3f840955e..03f9134d6 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.149'; -PDFJS.build = '3f3fb1e'; +PDFJS.version = '1.1.151'; +PDFJS.build = '07af86c'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -973,6 +973,10 @@ function stringToUTF8String(str) { return decodeURIComponent(escape(str)); } +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} + function isEmptyObj(obj) { for (var key in obj) { return false; diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 76d5a5206..fe8462f95 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.149'; -PDFJS.build = '3f3fb1e'; +PDFJS.version = '1.1.151'; +PDFJS.build = '07af86c'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -973,6 +973,10 @@ function stringToUTF8String(str) { return decodeURIComponent(escape(str)); } +function utf8StringToString(str) { + return unescape(encodeURIComponent(str)); +} + function isEmptyObj(obj) { for (var key in obj) { return false; @@ -9652,6 +9656,14 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() { var fileIdBytes = stringToBytes(fileId); var passwordBytes; if (password) { + if (revision === 6) { + try { + password = utf8StringToString(password); + } catch (ex) { + warn('CipherTransformFactory: ' + + 'Unable to convert UTF8 encoded password.'); + } + } passwordBytes = stringToBytes(password); } @@ -9756,7 +9768,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() { CipherTransformFactory.prototype = { createCipherTransform: - function CipherTransformFactory_createCipherTransform(num, gen) { + function CipherTransformFactory_createCipherTransform(num, gen) { if (this.algorithm === 4 || this.algorithm === 5) { return new CipherTransform( buildCipherConstructor(this.cf, this.stmf, diff --git a/package.json b/package.json index 782160cb7..f0276c0f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.149", + "version": "1.1.151", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",