Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaff9a53

Browse files
MOHIT51196marco-ippolito
authored andcommitted
src: fix env-file flag to ignore spaces before quotes
Fix to ignore spaces between '=' and quoted string in env fileFixes:#53461Signed-off-by: Mohit Malhotra <dev.mohitmalhotra@gmail.com>PR-URL:#53786Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent31fdb88 commitaff9a53

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

‎src/node_dotenv.cc

Lines 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;

‎test/fixtures/dotenv/valid.env

Lines 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=therealnerdybeast@example.tld
4243
SPACED_KEY=parsed
4344
EDGE_CASE_INLINE_COMMENTS="VALUE1" # or "VALUE2" or "VALUE3"

‎test/parallel/test-dotenv.js

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp