Fix non recursive folder delete using file system #13361
Merged
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.
Fixes #13349
Deleting a folder without recursive enabled failed as the used nodejs API unlink does not support folder deletion. Fixing it by first checking if it is a folder, and if so using rmdir instead.
Added a simple unit test, which also exposed that
the folder deletion also fails when using trash support, but that is a different issue.
What it does
Handle the deletion of a folder using the file system api.
Previously this did only work when asking to delete the folders content as well, now with recursive: false,
it does delete the folder if it is empty.
How to test
I did add a unit test, which fails without the fix.
Follow-ups
I did notice that when using the trash support, the deletion of a folder with content (recursive: true) did fail.
Review checklist
Reminder for reviewers