src: improve node::Dotenv trimming · nodejs/node@0d1e797 · GitHub
Skip to content

Commit 0d1e797

Browse files
dario-piotrowiczanonrig
authored andcommitted
src: improve node::Dotenv trimming
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 <yagiz@nizipli.com> PR-URL: #56983 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 50f164e commit 0d1e797

3 files changed

Lines changed: 46 additions & 5 deletions

File tree

src/node_dotenv.cc

Lines changed: 19 additions & 5 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
EMPTY_LINE='value after an empty line'
3+
4+
SPACES_LINE='value after a line with just some spaces'
5+
6+
TABS_LINE='value after a line with just some tabs'
7+
8+
SPACES_TABS_LINE='value after a line with just some spaces and tabs'

test/parallel/test-dotenv-edge-cases.js

Lines changed: 19 additions & 0 deletions

0 commit comments

Comments
 (0)