Skip to content

fix: always follow symlinks when pasting remote files#3406

Merged
sxyazi merged 2 commits intomainfrom
pr-3b8c2d03
Dec 5, 2025
Merged

fix: always follow symlinks when pasting remote files#3406
sxyazi merged 2 commits intomainfrom
pr-3b8c2d03

Conversation

@sxyazi
Copy link
Owner

@sxyazi sxyazi commented Dec 5, 2025

Follow-up to #3396

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AsPath to AsStrand to support cross-filesystem paths
  • Introduced follow1 field 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))
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copilot uses AI. Check for mistakes.
@sxyazi sxyazi merged commit 581f292 into main Dec 5, 2025
9 checks passed
@sxyazi sxyazi deleted the pr-3b8c2d03 branch December 5, 2025 15:22
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants