Skip to content

Commit

Permalink
explicitly reject on wrong password
Browse files Browse the repository at this point in the history
  • Loading branch information
mansurt committed Apr 6, 2017
1 parent d36e4d0 commit 1fe5755
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ module.exports = function (archive, dest, options) {
if (isUnsupportedMethod) {
return reject(new Error('Unsupported Method'))
}
let isWrongPassword = (data.search('Data Error in encrypted file. Wrong password?') != -1)
? true
: false;
if (isWrongPassword) {
return reject(new Error('Data Error in encrypted file. Wrong password?'));
}

data.split('\n').forEach(function (line) {
if (line.substr(0, 12) === 'Extracting ') {
Expand Down
9 changes: 7 additions & 2 deletions lib/extractFull.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ module.exports = function (archive, dest, options) {
? true
: false;
if (isUnsupportedMethod) {
return reject(new Error('Unsupported Method'))
return reject(new Error('Unsupported Method'));
}
let isWrongPassword = (data.search('Data Error in encrypted file. Wrong password?') != -1)
? true
: false;
if (isWrongPassword) {
return reject(new Error('Data Error in encrypted file. Wrong password?'));
}

var entries = [];
data.split('\n').forEach(function (line) {
if (line.substr(0, 12) === 'Extracting ') {
entries.push(line.substr(12, line.length).replace(path.sep, '/'));
Expand Down

0 comments on commit 1fe5755

Please sign in to comment.