priyasirohi09 / joplin

Other
2 stars 91 forks source link

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

Open SyedAyaanAli6786 opened 3 months ago

SyedAyaanAli6786 commented 3 months ago

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:

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.