Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
src: improve node::Dotenv trimming#56983
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
src: improve node::Dotenv trimming #56983
Uh oh!
There was an error while loading. Please reload this page.
Conversation
3dba125 to ff0ffe4CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
b5dd12f to 00d9449CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
anonrig commented Feb 10, 2025
Looking good. After these changes, we can land this pull-request. @dario-piotrowicz |
1eb6236 to eabaf64Comparethe trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]>eabaf64 to 47d1a76Comparedario-piotrowicz commented Feb 10, 2025
@anonrig thank you very much for your review and help here 🙏 (and sorry for the silly mistakes 😓) I've applied all your suggested changes 🙂 |
nodejs-github-bot commented Feb 10, 2025
codecovbot commented Feb 10, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #56983 +/- ## ========================================== - Coverage 89.13% 89.13% -0.01% ========================================== Files 665 665 Lines 193167 193177 +10 Branches 37190 37193 +3 ========================================== + Hits 172185 172192 +7 - Misses 13731 13743 +12 + Partials 7251 7242 -9
|
anonrig commented Feb 10, 2025
@dario-piotrowicz the tests are failing |
remove pos_start == pos_end check
dario-piotrowicz commented Feb 10, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Sorry about that, I've addressed it 🙂 (e3ee074) The issue was this new check: if (pos_start == pos_end){return""}since if I removed the check completely (instead of returning do you agree? PS: that's not the only issue 🤔 |
add check for when no value is present
6d32733 to c261fb4Comparenodejs-github-bot commented Feb 10, 2025
| if (input.front() == ''){ | ||
| input.remove_prefix(input.find_first_not_of('')); | ||
| auto pos_start = input.find_first_not_of("\t\n"); |
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.
should this also include \r and \f?
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.
sounds good to me 🙂, but I'm not sure how to test that, would you be ok with addition without dedicated tests for it?
43ffcf1 into nodejs:mainUh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Feb 11, 2025
Landed in 43ffcf1 |
the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: nodejs#56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well Co-authored-by: Yagiz Nizipli <[email protected]> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
the trimming functionality that the dotenv parsing uses currently only takes into consideration plain spaces (' '), other type of space characters such as tabs and newlines are not trimmed, this can cause subtle bugs, so the changes here make sure that such characters get trimmed as well
Fixes#56686