Skip to content

fix: reject repositories.<name>.url in config#10846

Closed
lawrence3699 wants to merge 1 commit intopython-poetry:mainfrom
lawrence3699:fix/config-repositories-url-key
Closed

fix: reject repositories.<name>.url in config#10846
lawrence3699 wants to merge 1 commit intopython-poetry:mainfrom
lawrence3699:fix/config-repositories-url-key

Conversation

@lawrence3699
Copy link
Copy Markdown

Fixes #10570.

Before

poetry config repositories.repo2.url https://... is accepted even though the documented CLI syntax is poetry config repositories.<name> <url>.

That writes a nested [repositories.repo2.url] table to config.toml, which then makes commands such as poetry config --list fail with unhashable type: 'dict'.

After

Reject repositories.<name>.url when setting repository URLs and point users to the documented repositories.<name> form instead.

This keeps the existing repositories.<name>.url read path intact while preventing the bad write that corrupts the config structure.

Validation

  • .venv/bin/pytest tests/console/commands/test_config.py -q
  • manual repro with POETRY_CONFIG_DIR=$(mktemp -d)
    • before: poetry config repositories.repo2.url https://... corrupted config.toml and poetry config --list failed
    • after: the invalid write is rejected and poetry config --list succeeds

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.

Poetry config can be messed up by incorrect user command

1 participant