Skip to content

enhance error handling for drag operations#79

Open
markgandolfo wants to merge 1 commit into
crabnebula-dev:v2from
Asset-Hoard:v2
Open

enhance error handling for drag operations#79
markgandolfo wants to merge 1 commit into
crabnebula-dev:v2from
Asset-Hoard:v2

Conversation

@markgandolfo

Copy link
Copy Markdown

This pull request improves error handling and robustness in the Windows drag-and-drop implementation by replacing panics and unwraps with proper error propagation. It introduces a new error variant for invalid shell paths, updates several internal functions to return results instead of options, and adds comprehensive tests to ensure correct error handling for invalid paths.

Written to mitigate #72

This doesn't solve the UNC security issue, but at least least lets the app's manage the error without crashing.

Error handling improvements:

  • Added a new error variant InvalidShellPath to the Error enum to represent failures when resolving shell paths during drag operations.
  • Updated get_file_data_object, get_shell_item_array, and get_file_item_id to return Result types and propagate errors instead of panicking or unwrapping, ensuring safer error handling throughout the drag-and-drop code path.
  • Modified start_drag to propagate errors from get_file_data_object instead of using unwrap, preventing panics during drag operations with invalid paths. [1] [2]

Testing and validation:

  • Added unit tests for get_file_item_id, get_shell_item_array, and get_file_data_object to verify correct error handling for non-existent and invalid paths, increasing code robustness.

@markgandolfo

Copy link
Copy Markdown
Author

repushed with signed commit..

@aleksey-hoffman

aleksey-hoffman commented May 21, 2026

Copy link
Copy Markdown

Thanks for the fix. Will this get merged soon?
I need this fix for my app as well, it would be lovely if you guys merged it

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.

2 participants