Skip to content

fix: use the default when an interpolated variable is empty - #716

Open
SashaMIT wants to merge 1 commit into
theskumar:mainfrom
SashaMIT:empty-default
Open

SashaMIT wants to merge 1 commit into
theskumar:mainfrom
SashaMIT:empty-default

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown

Purpose

${name:-default} is the POSIX form that uses the default when name is unset or empty. An empty value was returned as itself.

b= followed by a=${b:-d} produced a equal to "". The same input with b missing already produced d. b=c still stays c. ${b} with no default stays empty.

fixes #715

Test plan

  • pytest tests/test_variables.py tests/test_main.py::test_dotenv_values_string_io (29 passed)

${name:-default} returned the empty string when name was set to
nothing. POSIX uses the default in that case. A missing name already did.

This branch has not been deployed

No deployments
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.

An empty value ignores ${name:-default}

1 participant