Repository navigation
Delete a symlink itself, not what it points to - #42
Merged
Merged
Conversation
delete_path() resolved the path before deleting, so deleting a symlink in Shared Files deleted its target, and rmtree emptied a linked folder. A symlink is now unlinked on its own; everything else is unchanged. Fixes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #41
What changed
delete_path()now looks at the entry itself before resolving it: if it's a symlink, the link is unlinked and its target is left alone. The parent directory still goes throughsafe_path(), so the entry can't be outside the shared folder; non-link paths take the old route (traversal still rejected, root still protected).Testing
pytest: 5 new tests intests/test_file_manager.py(link to a folder, link to a file, link pointing outside the shared folder, link in a subfolder, traversal on delete). The four symlink tests skip where symlinks can't be created, as on the Windows dev machine.delete_path()with FastAPI stubbed: all pass with the fix; the original empties the linked folder and leaves the link behind.🤖 Generated with Claude Code