Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Nodeenv changelog
Version [unreleased]
--------------------

- A ``%`` in a ``[nodeenv]`` config value, such as a percent-encoded
mirror login, no longer crashes nodeenv; values are read as written,
so a ``%%`` that worked around the crash is now read as ``%%``
`#440 <https://github.com/ekalinin/nodeenv/issues/440>`_
- `nodeenv -p` no longer puts the python venv's `bin` directory on `PATH`
a second time: the venv's own `activate` and `activate.fish` put it there
already. Envs without those scripts, such as conda envs, and the git-bash
Expand Down
3 changes: 2 additions & 1 deletion nodeenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def _load(cls, configfiles, verbose=False):
if not os.path.exists(configfile):
continue

ini_file = ConfigParser()
# No interpolation: a percent-encoded mirror URL is valid, #440
ini_file = ConfigParser(interpolation=None)
ini_file.read(configfile)
section = "nodeenv"
if not ini_file.has_section(section):
Expand Down
13 changes: 13 additions & 0 deletions tests/nodeenv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,19 @@ def test_config_strips_quotes(tmpdir):
nodeenv.Config.mirror = nodeenv.Config._default['mirror']


def test_config_keeps_percent_signs(tmpdir):
"""A % in a value is read as is, not as interpolation, see #440"""
rc = tmpdir.join('nodeenvrc')
rc.write('[nodeenv]\n'
'mirror = https://user:p%40ss@mirror.example/nodejs\n')
try:
nodeenv.Config._load([str(rc)])
assert nodeenv.Config.mirror == \
'https://user:p%40ss@mirror.example/nodejs'
finally:
nodeenv.Config.mirror = nodeenv.Config._default['mirror']


@pytest.fixture
def auth_mirror(monkeypatch):
"""
Expand Down
Loading