Skip to content

fix(sftp): resolve symlinks for accurate download progress (#52) - #53

Merged
Orinks merged 1 commit into
devfrom
fix/symlink-download-progress
Mar 2, 2026
Merged

fix(sftp): resolve symlinks for accurate download progress (#52)#53
Orinks merged 1 commit into
devfrom
fix/symlink-download-progress

Conversation

@Orinks

@Orinks Orinks commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes download progress stuck at 0% for files in symlinked directories.

  • protocols.py: SFTPClient.download() now calls sftp.realpath() before stat/get to resolve symlinks, falling back to the original path if realpath fails
  • dialogs/transfer.py: Download and upload callbacks guard item.total_bytes — a reported total=0 no longer overwrites a previously known positive value
  • dialogs/transfer.py: Recursive downloads re-stat any file with size=0 (common for symlink entries in directory listings) before summing total_bytes

Test plan

  • 3 new tests for symlink resolution in SFTPClient.download() (native get, BytesIO fallback, realpath failure)
  • 3 new tests for callback total_bytes guard (download preserves, upload preserves, positive updates work)
  • 3 new tests for recursive download re-stat (zero-size resolved, non-zero skipped, stat failure handled)
  • All 378 existing tests pass with no regressions

Closes #52

🤖 Generated with Claude Code

Three fixes for download progress stuck at 0% in symlinked directories:

1. Use sftp.realpath() before stat() in SFTPClient.download() so file
   size is read from the resolved target, not the symlink entry.
2. Guard item.total_bytes in transfer callbacks: do not overwrite a
   positive value with 0 when the progress handler reports total=0.
3. Re-stat zero-size files in recursive downloads before summing
   total_bytes, catching symlink entries whose size was reported as 0
   by the directory listing.

Closes #52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Orinks
Orinks merged commit e04fcea into dev Mar 2, 2026
6 checks passed
@Orinks
Orinks deleted the fix/symlink-download-progress branch March 2, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant