enhance error handling for drag operations#79
Open
markgandolfo wants to merge 1 commit into
Open
Conversation
Author
|
repushed with signed commit.. |
|
Thanks for the fix. Will this get merged soon? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
InvalidShellPathto theErrorenum to represent failures when resolving shell paths during drag operations.get_file_data_object,get_shell_item_array, andget_file_item_idto returnResulttypes and propagate errors instead of panicking or unwrapping, ensuring safer error handling throughout the drag-and-drop code path.start_dragto propagate errors fromget_file_data_objectinstead of usingunwrap, preventing panics during drag operations with invalid paths. [1] [2]Testing and validation:
get_file_item_id,get_shell_item_array, andget_file_data_objectto verify correct error handling for non-existent and invalid paths, increasing code robustness.