fix: always follow symlinks when pasting remote files#3406
Merged
Conversation
8 tasks
There was a problem hiding this comment.
Pull request overview
This PR fixes symlink handling when pasting files across different filesystems (e.g., from remote SFTP to local). The main change is to always follow symlinks when copying between different schemes, ensuring that the actual file content is copied rather than just creating a dangling symlink reference.
- Changed symlink function signatures from
AsPathtoAsStrandto support cross-filesystem paths - Introduced
follow1field to automatically follow symlinks when pasting across filesystem boundaries - Refactored timeout handling and buffer size constants for better maintainability
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yazi-vfs/src/provider/sftp/sftp.rs | Updated symlink method signature to use AsStrand instead of AsPath |
| yazi-vfs/src/provider/providers.rs | Updated symlink method signatures to use AsStrand trait |
| yazi-vfs/src/provider/provider.rs | Updated public symlink function signatures to use AsStrand |
| yazi-vfs/src/provider/copier.rs | Extracted magic numbers to named constants (BUF_SIZE, PER_CHUNK) and refactored error handling |
| yazi-sftp/src/session.rs | Increased default timeout from 30s to 45s and extracted send_with_timeout method |
| yazi-sftp/src/fs/read_dir.rs | Added configurable timeout for directory reading operations |
| yazi-scheduler/src/scheduler.rs | Implemented follow1 logic to automatically follow symlinks when schemes differ, simplified error handling |
| yazi-scheduler/src/file/in.rs | Renamed follow field to follow1 with formatting alignment |
| yazi-scheduler/src/file/file.rs | Updated paste logic to check follow1 before attempting rename, removed filesystem check from link_do |
| yazi-fs/src/provider/traits.rs | Changed symlink trait method signatures to accept AsStrand |
| yazi-fs/src/provider/local/local.rs | Updated local provider's symlink methods to use AsStrand |
| yazi-fs/src/path/relative.rs | Fixed path kind selection to use source path instead of target path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.name = match self.session.send(requests::ReadDir::new(&self.handle)).await { | ||
| let result = self | ||
| .session | ||
| .send_with_timeout(requests::ReadDir::new(&self.handle), Duration::from_mins(5)) |
There was a problem hiding this comment.
Duration::from_mins does not exist in the standard library. Use Duration::from_secs(5 * 60) instead to create a 5-minute duration.
Suggested change
| .send_with_timeout(requests::ReadDir::new(&self.handle), Duration::from_mins(5)) | |
| .send_with_timeout(requests::ReadDir::new(&self.handle), Duration::from_secs(5 * 60)) |
sxyazi
added a commit
that referenced
this pull request
Dec 5, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #3396