fix: restore multiline support for unquoted values (fixes #555)#570
fix: restore multiline support for unquoted values (fixes #555)#570Pritish053 wants to merge 1 commit intotheskumar:mainfrom
Conversation
Multiline support for unquoted values was accidentally removed in commit 7b172fe when fixing space parsing issues. This commit restores the functionality by enhancing parse_unquoted_value() to properly handle continuation lines. The fix: - Looks ahead after reading the first line of an unquoted value - Identifies continuation lines using smart heuristics - Treats single-letter lines as variable names, longer lines as continuations - Properly handles multiline content while preserving existing behavior - Maintains correct line numbering and position tracking All existing tests pass, confirming no regressions were introduced.
|
@bbc2 would you have time to take a look this issue? |
|
The issue mentioned here (#555) refers to quoted values, which is different from what is being tackled by this PR, so the assertion that this PR fixes the mentioned issue seems false. Also, the file format only allows multi-line values if quotes are used: https://github.com/theskumar/python-dotenv?tab=readme-ov-file#multiline-values. I'm not saying we can't change that, but this most likely not a bug. By the way, we have done breaking changes in the past (#170) although we should certainly avoid them as much as possible. I'm sorry but so far I don't see enough justification for applying this change. My suggestion is to close this PR unless we get evidence that the current behavior is an issue. @Pritish053 And in any case, I thank you for your interest in the project. Extra notes:
|
Restores multiline support for unquoted environment variables that was inadvertently removed in commit 7b172fe during space
parsing improvements. This enhancement allows load_dotenv() to correctly parse multiline values without quotes while maintaining
backward compatibility.
Implementation details:
Comprehensive testing ensures no regressions across the existing 198-test suite.
PR Description
Summary
Resolves #555 by restoring the ability for
load_dotenv()to correctly parse multiline unquoted environment variables that spanmultiple lines.
Problem
In 2020, commit 7b172fe simplified
the
parse_unquoted_value()function to fix space parsing issues, but inadvertently removed support for multiline unquotedvalues. This caused
load_dotenv()to only read the first line of multiline values.Solution
Restored multiline parsing capability through intelligent continuation line detection:
Impact
Before (Broken):