Skip to content

Fix full FTP URLs in direct file downloads - #2221

Merged
martindurant merged 1 commit into
fsspec:masterfrom
rioyu123:codex/ftp-download-urls
Oct 2, 2026
Merged

martindurant merged 1 commit into
fsspec:masterfrom
rioyu123:codex/ftp-download-urls

Conversation

@rioyu123

@rioyu123 rioyu123 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Direct FTP reads and downloads did not handle full URLs consistently. cat_file("ftp://host:port/file") and get_file() passed the entire URL to RETR, so the server could not find the file. Reads with an end or a negative start already worked because they went through the buffered-file path.

Strip the protocol before either direct download path sends its command, using the same normalization as the other FTP methods.

This also makes direct relative paths start from /, matching the other FTP methods.

Tests

  • Added cases for full and partial reads, plus downloads to a local path and a file-like object, using the existing local FTP server fixture.
  • Before the fix: four new cases failed; the two buffered-read controls passed.
  • After the fix: all 39 FTP tests passed; pytest fsspec/tests -q --ignore=fsspec/tests/test_downstream.py: 884 passed, 11 skipped, 2 xfailed.
  • Changed-file Ruff checks and wheel/sdist builds passed.

@martindurant
martindurant merged commit 778f956 into fsspec:master Oct 2, 2026
11 checks passed
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.

2 participants