Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes if wrong key is passed to decryptFile() #14

Open
jainanuj7 opened this issue Feb 13, 2019 · 1 comment
Open

Application crashes if wrong key is passed to decryptFile() #14

jainanuj7 opened this issue Feb 13, 2019 · 1 comment

Comments

@jainanuj7
Copy link

jainanuj7 commented Feb 13, 2019

I manually commented out line 70 i.e. fs.unlink(outputPath); in lib/file-encryptor.js and the application doesn't crash after that. I think it is not able to unlink (delete) the file due to some reason.

NOTE: This only happens when invalid key is passed to the decryptFile() function.
Check the attached screenshot (from my heroku console)

error

@georgianamilitaru
Copy link

Encountered the same problem. Because stream is not close the file can not be deleted. For me even at retry with a correct password it did not work ( there was a file with no permission in the system, could not delete it or overwrite it).
Changed decryptFile catch to :

  outputStream.end();
  outputStream.on('close', function() {
    fs.unlink(outputPath);
    return callback(e);
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants