Skip to content

fix: quote filenames when making registries - #546

Open
binggao1230 wants to merge 1 commit into
fatiando:mainfrom
binggao1230:fix-369-quote-registry-filenames
Open

fix: quote filenames when making registries#546
binggao1230 wants to merge 1 commit into
fatiando:mainfrom
binggao1230:fix-369-quote-registry-filenames

Conversation

@binggao1230

@binggao1230 binggao1230 commented Jun 27, 2026

Copy link
Copy Markdown

Fixes #369.

Pooch.load_registry already uses shlex.split, so filenames with spaces can be read when they are quoted. make_registry was still writing raw filenames, which made generated registries ambiguous for names like LICENSE (copy).

This updates make_registry to quote the normalized registry filename with shlex.quote and adds a round-trip test for a filename containing spaces.

Verification:

uv run --with pytest --with-editable . pytest pooch/tests/test_hashes.py -q
uv run --with pytest --with pytest-httpserver --with pytest-localftpserver --with-editable . pytest pooch/tests/test_hashes.py pooch/tests/test_core.py -q
uv run --with ruff ruff check pooch/hashes.py pooch/tests/test_hashes.py
uv run --with ruff ruff format --check pooch/hashes.py pooch/tests/test_hashes.py
git diff --check

@binggao1230

Copy link
Copy Markdown
Author

The failing test jobs look unrelated to this change. In each failed job, the new regression test passes:

../tests/test_hashes.py::test_make_registry_quotes_files_with_spaces PASSED

The failures are all from the existing pooch.downloaders.HTTPDownloader doctest calling https://httpbin.org/basic-auth/doggo/goodboy, which returned 503/504 or timed out. The network-enabled job passed, and local full tests passed for me:

uv run --with pytest --with pytest-httpserver --with pytest-localftpserver --with-editable . pytest -q
# 142 passed, 19 skipped

I tried to rerun failed jobs, but GitHub does not allow me to rerun checks on the upstream repo.

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.

pooch.make_registry does not handle spaces in filenames correctly

1 participant