-
Notifications
You must be signed in to change notification settings - Fork 31.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: fix parseEnv incorrectly splitting multiple ‘=‘ in value #57421
Conversation
Review requested:
|
Previously, parseEnv would create multiple environment variables if a single line contained multiple ‘=‘ characters (e.g. A=B=C would become { A: ‘B=C’, B: ‘C’ }). This commit ensures that only the first ‘=‘ is used as the key-value delimiter, and the rest of the line is treated as the value. Fixes: nodejs#57411
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57421 +/- ##
==========================================
- Coverage 90.23% 90.23% -0.01%
==========================================
Files 630 629 -1
Lines 185219 184859 -360
Branches 36248 36215 -33
==========================================
- Hits 167140 166811 -329
+ Misses 11048 11018 -30
+ Partials 7031 7030 -1
🚀 New features to boost your workflow:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
Also, we should keep a test case for the unquoted version |
c7267a5
to
255c299
Compare
I have incorporated all the review comments and added the corresponding test cases. Please let me know if there are any further suggestions or improvements needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Commit Queue failed- Loading data for nodejs/node/pull/57421 ✔ Done loading data for nodejs/node/pull/57421 ----------------------------------- PR info ------------------------------------ Title util: fix parseEnv incorrectly splitting multiple ‘=‘ in value (#57421) Author HEESEUNG <[email protected]> (@rayark1) Branch rayark1:fix/57411 -> nodejs:main Labels c++, author ready, needs-ci, config Commits 6 - util: fix parseEnv incorrectly splitting multiple ‘=‘ in value - Update test/fixtures/dotenv/valid.env - Update benchmark/fixtures/valid.env - refactor: apply comment - test: add test case - add: test case for DOUBLE_QUOTES Committers 2 - Heeseung <[email protected]> - GitHub <[email protected]> PR-URL: https://github.com/nodejs/node/pull/57421 Fixes: https://github.com/nodejs/node/issues/57411 Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Matteo Collina <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/57421 Fixes: https://github.com/nodejs/node/issues/57411 Reviewed-By: Daniel Lemire <[email protected]> Reviewed-By: Matteo Collina <[email protected]> -------------------------------------------------------------------------------- ℹ This PR was created on Wed, 12 Mar 2025 05:31:31 GMT ✔ Approvals: 2 ✔ - Daniel Lemire (@lemire): https://github.com/nodejs/node/pull/57421#pullrequestreview-2679120207 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/57421#pullrequestreview-2722574029 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-04-05T17:46:19Z: https://ci.nodejs.org/job/node-test-pull-request/66056/ - Querying data for job/node-test-pull-request/66056/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 57421 From https://github.com/nodejs/node * branch refs/pull/57421/merge -> FETCH_HEAD ✔ Fetched commits as 214e3d4affab..1ac38ad56bfb -------------------------------------------------------------------------------- [main 2c84c9c79c] util: fix parseEnv incorrectly splitting multiple ‘=‘ in value Author: Heeseung <[email protected]> Date: Tue Mar 11 11:15:13 2025 -0700 5 files changed, 33 insertions(+), 8 deletions(-) [main de0c2f0a1a] Update test/fixtures/dotenv/valid.env Author: HEESEUNG <[email protected]> Date: Fri Mar 14 04:14:01 2025 +0900 1 file changed, 1 insertion(+), 1 deletion(-) [main 0b421493f7] Update benchmark/fixtures/valid.env Author: HEESEUNG <[email protected]> Date: Fri Mar 14 04:14:10 2025 +0900 1 file changed, 1 insertion(+), 1 deletion(-) [main 162d087172] refactor: apply comment Author: Heeseung <[email protected]> Date: Thu Mar 13 21:28:56 2025 -0700 3 files changed, 9 insertions(+), 13 deletions(-) [main f7e1303268] test: add test case Author: Heeseung <[email protected]> Date: Fri Mar 14 11:25:53 2025 -0700 4 files changed, 8 insertions(+) [main e4f0160a43] add: test case for DOUBLE_QUOTES Author: Heeseung <[email protected]> Date: Mon Mar 17 08:57:43 2025 -0700 1 file changed, 1 insertion(+) ✔ Patches applied There are 6 commits in the PR. Attempting autorebase. Rebasing (2/12) Executing: git node land --amend --yes ⚠ Found Fixes: https://github.com/nodejs/node/issues/57411, skipping.. --------------------------------- New Message ---------------------------------- util: fix parseEnv incorrectly splitting multiple ‘=‘ in valuehttps://github.com/nodejs/node/actions/runs/14286187364 |
Landed in e6a0d77 |
Previously, parseEnv would create multiple environment variables if a single line contained multiple ‘=‘ characters (e.g. A=B=C would become { A: ‘B=C’, B: ‘C’ }).
This commit ensures that only the first ‘=‘ is used as the key-value delimiter, and the rest of the line is treated as the value.
Fixes: #57411