-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
util: fix parseEnv handling of invalid lines #57798
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 handling of invalid lines #57798
Conversation
Review requested:
|
@@ -257,13 +285,13 @@ void Dotenv::ParseContent(const std::string_view input) { | |||
// Example: KEY=value # comment | |||
// The value pair should be `value` | |||
if (hash_character != std::string_view::npos) { | |||
value = content.substr(0, hash_character); | |||
value = value.substr(0, hash_character); |
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.
Why did you make this change? Please add a test that covers this.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57798 +/- ##
==========================================
- Coverage 90.23% 90.23% -0.01%
==========================================
Files 630 630
Lines 185288 185294 +6
Branches 36344 36341 -3
==========================================
- Hits 167203 167202 -1
- Misses 11006 11017 +11
+ Partials 7079 7075 -4
🚀 New features to boost your workflow:
|
I had added some test case for |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
// Returns an empty string_view if the input is empty. | ||
// Example: | ||
// trim_spaces(" hello ") -> "hello" | ||
// trim_spaces("") -> "" |
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.
Not new to this PR but it occurs to me that this function overlooks the often-overlooked vertical tab (0x0B).
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.
I maybe can help on that, but I don't know what your are talking about
Landed in 64d9b7c |
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
PR-URL: #57798 Fixes: #56775 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
This PR fixes an issue with
util.parseEnv()
where invalid lines in the input were being incorrectly concatenated into key names instead of being skipped. The fix ensures that lines without an equals sign are properly skipped during parsingFixes: #56775
I lost my old pr due to a git failure 😅
#56778