-
Notifications
You must be signed in to change notification settings - Fork 30.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
--env-file
parses commented out parts, when they contain quotation marks
#51508
Labels
Comments
This is also fixed in this PR #51289 |
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Feb 2, 2024
PR-URL: nodejs#51510 Fixes: nodejs#51508 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
marco-ippolito
added a commit
to marco-ippolito/node
that referenced
this issue
Feb 19, 2024
PR-URL: nodejs#51510 Fixes: nodejs#51508 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Version
v20.9.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
No response
What steps will reproduce the bug?
when using a .env file with entries like the one below, where there is a commented out part, nodeJS will parse the whole line as value, instead of just the expected "VALUE1" part.
KEY="VALUE1" # or "VALUE2" or "VALUE3"
How often does it reproduce? Is there a required condition?
Only happens, if the commented out part contains quotation marks as well.
Comments without quotation marks are correctly ignored, e.g.
KEY="VALUE1" # or 'VALUE2' or 'VALUE3'
will correctly only parse theVALUE1
part as valueWhat is the expected behavior? Why is that the expected behavior?
process.env.KEY should have the value
VALUE1
only, the rest of the line is a comment that should not be parsedWhat do you see instead?
Currently it parsed the whole line instead, removing the first and last quotation mark:
PROD" # or "TEST" or "DEV
So it looks like the behaviour currently is to find the first and last quotation mark and treat everything in between as the value.
The same line, when parsed by
dotenv
does not give the same wrong result.Additional information
No response
The text was updated successfully, but these errors were encountered: