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

Fix Error When Canceling Bulk PDF Export Due to Incorrect Handling of Return Type from bridge().showOpenDialog() #281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SyedAyaanAli6786
Copy link

Description

This pull request addresses issue #280, which reports an error that occurs when canceling a bulk PDF export. The error arises because the code incorrectly assumes that bridge().showOpenDialog() always returns a string. In cases where no output paths are selected, the function returns an empty array ([]), leading to an error when the cancellation is processed.

Changes Implemented:

  • Updated the code to properly handle the return type of bridge().showOpenDialog(), allowing for both strings and arrays of strings.
  • Added a check to account for the possibility of receiving an empty array when no output paths are selected.
  • Ensured that canceling the export operation does not trigger an error dialog.

Testing Plan:

  1. Select two notes in the application.
  2. Click "Export" > "PDF."
  3. Click "Cancel."
  4. Verify that no error dialog appears.
  5. Select the same two notes again.
  6. Click "Export," then "PDF."
  7. Select an empty output directory.
  8. Click "Open."
  9. Verify that the directory contains the exported PDF files without any errors.

This fix has been successfully tested on Ubuntu 24.04.

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

Successfully merging this pull request may close these issues.

1 participant