Skip to content

fix(transfer): stop folder downloads looping until they crash - #142

Merged
Orinks merged 1 commit into
devfrom
fix/folder-download-crash
Aug 28, 2026
Merged

fix(transfer): stop folder downloads looping until they crash#142
Orinks merged 1 commit into
devfrom
fix/folder-download-crash

Conversation

@Orinks

@Orinks Orinks commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Recursive folder downloads listed the remote tree with no record of directories already seen. A server that names the current folder (or its parent) as a child — FTP cdir/pdir with a real path, a WebDAV self-href — or an SFTP directory symlink pointing back at an ancestor was walked until the process ran out of memory. That is the crash on downloading a folder, especially a large one: listing never finishes, progress stays at 0%, then the app dies.
  • The walker now treats the canonical path as directory identity, skips a child that is the folder already being listed, and SFTP realpath collapses symlink cycles. FTP MLSD drops cdir/pdir regardless of how they are named.
  • Tests that would have caught it: a self-child listing, a parent-pointer listing, a symlink-to-ancestor, a 400-deep tree, and an 8,000-file folder, each with a listing budget so an unbounded walk fails the test instead of hanging.

Test plan

  • cargo test -p portkeydrop-core --lib (528 passed)
  • cargo clippy -p portkeydrop-core --all-targets -- -D warnings
  • Download a normal nested folder over SFTP and confirm files land and empty-cycle folders do not hang
  • If Joshua can say SFTP vs WebDAV vs FTP and roughly how large the folder was, we can confirm this matches the report; no log is required for the unbounded-listing crash itself

Recursive listing had no memory of directories already seen, so an FTP
cdir/pdir with a real path, a WebDAV self-href, or an SFTP directory
symlink back to a parent was walked until the process ran out of memory.
@Orinks
Orinks merged commit 4a4e284 into dev Aug 28, 2026
6 checks passed
@Orinks
Orinks deleted the fix/folder-download-crash branch August 28, 2026 18:31
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