GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix env-file flag to ignore spaces before quotes · nodejs/node@c53cf44

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_dotenv.cc
  • test
    • fixtures/dotenv
      • valid.env
    • parallel
      • test-dotenv.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_dotenv.cc‎

Copy file name to clipboardExpand all lines: src/node_dotenv.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ void Dotenv::ParseContent(const std::string_view input) {
129129
key = content.substr(0, equal);
130130
content.remove_prefix(equal + 1);
131131
key = trim_spaces(key);
132+
content = trim_spaces(content);
132133

133134
if (key.empty()) {
134135
break;
Collapse file

‎test/fixtures/dotenv/valid.env‎

Copy file name to clipboardExpand all lines: test/fixtures/dotenv/valid.env
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ RETAIN_INNER_QUOTES={"foo": "bar"}
3838
RETAIN_INNER_QUOTES_AS_STRING='{"foo": "bar"}'
3939
RETAIN_INNER_QUOTES_AS_BACKTICKS=`{"foo": "bar's"}`
4040
TRIM_SPACE_FROM_UNQUOTED= some spaced out string
41+
SPACE_BEFORE_DOUBLE_QUOTES= "space before double quotes"
4142
EMAIL=[email protected]
4243
SPACED_KEY = parsed
4344
EDGE_CASE_INLINE_COMMENTS="VALUE1" # or "VALUE2" or "VALUE3"
Collapse file

‎test/parallel/test-dotenv.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-dotenv.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ assert.strictEqual(process.env.DONT_EXPAND_UNQUOTED, 'dontexpand\\nnewlines');
8080
assert.strictEqual(process.env.DONT_EXPAND_SQUOTED, 'dontexpand\\nnewlines');
8181
// Ignore export before key
8282
assert.strictEqual(process.env.EXPORT_EXAMPLE, 'ignore export');
83+
// Ignore spaces before double quotes to avoid quoted strings as value
84+
assert.strictEqual(process.env.SPACE_BEFORE_DOUBLE_QUOTES, 'space before double quotes');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.