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:
Select two notes in the application.
Click "Export" > "PDF."
Click "Cancel."
Verify that no error dialog appears.
Select the same two notes again.
Click "Export," then "PDF."
Select an empty output directory.
Click "Open."
Verify that the directory contains the exported PDF files without any errors.
This fix has been successfully tested on Ubuntu 24.04.
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:
bridge().showOpenDialog()
, allowing for both strings and arrays of strings.Testing Plan:
This fix has been successfully tested on Ubuntu 24.04.