Correctly handle non-recursive delete of non-empty directory#71
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves deletion handling for non-empty directories by returning an error when attempting a non-recursive delete.
- Added a new test case to verify non-recursive deletion fails for non-empty directories
- Updated the delete method to include an options parameter and a guard clause for non-recursive deletion
- Ensured appropriate metadata handling during delete operations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/ItemDeleteTests.swift | Added test case for non-recursive deletion on non-empty directory |
| Sources/NextcloudFileProviderKit/Item/Item+Delete.swift | Updated delete method to check deletion options and return error for non-empty directories |
Comments suppressed due to low confidence (1)
Sources/NextcloudFileProviderKit/Item/Item+Delete.swift:27
- [nitpick] The variable name 'isEmptyDirOrIsFile' could be clearer. Consider renaming it to 'hasNoChildItems' to better convey its purpose.
let isEmptyDirOrIsFile = childItemCount == nil || childItemCount == 0
…f non-empty directory Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
7f98965 to
685bfb6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
==========================================
+ Coverage 81.11% 81.21% +0.10%
==========================================
Files 62 60 -2
Lines 13039 13104 +65
==========================================
+ Hits 10576 10642 +66
+ Misses 2463 2462 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
No description provided.