ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.34k stars 117 forks source link

Infinite recursion on incorrect password attempt when importing PDF #120

Closed anandubajith closed 7 months ago

anandubajith commented 7 months ago

Describe your Environment OS: Mac Ventura Apple Silicion Paisa Version: 0.5.1 Browser: Arc App Variant: N/A

Describe the bug If we accidentally try to open a password protected PDF file which we don't know the password for, there is no way to exit out of the same. To Reproduce Steps to reproduce the behavior:

  1. Go to Ledger -> Import
  2. Open a password protected PDF file
  3. Enter incorrect password
  4. Keeps prompting again and again for password with no way to exit out of this ( there is option to prevent page from creating more alerts , but it's not ideal )

Expected behavior Should stop prompting for password after N attempts, or allow the user to choose a different file

Screenshots https://github.com/ananthakumaran/paisa/assets/3852827/b64db59f-8828-4d9a-91a5-0d84de74b15f

Journal N/A

anandubajith commented 7 months ago

Related PR: https://github.com/ananthakumaran/paisa/pull/119

ananthakumaran commented 7 months ago

I noticed the issue during the first implementation and didn't fix it because the underlying library didn't provide a clean API to solve this problem. I will have another look at the issue

anandubajith commented 7 months ago

@ananthakumaran Thanks!

According to this discussion, throwing error inside the onPassword callback seems to be the way to go

ananthakumaran commented 7 months ago

Cancel should now actually cancel the prompt.