dotenv-rs / dotenv

Library to help supply environment variables in testing and development
MIT License
557 stars 85 forks source link

Add multi-line support #63

Open tustvold opened 4 years ago

tustvold commented 4 years ago

Fixes #40

codecov[bot] commented 4 years ago

Codecov Report

Merging #63 into master will increase coverage by 1.04%. The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
+ Coverage   86.77%   87.82%   +1.04%     
==========================================
  Files           7        7              
  Lines         242      271      +29     
==========================================
+ Hits          210      238      +28     
- Misses         32       33       +1     
Impacted Files Coverage Δ
dotenv/src/iter.rs 93.87% <93.75%> (-0.86%) :arrow_down:
dotenv/src/find.rs 90.90% <0.00%> (+3.95%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3c1a77b...0b99e5b. Read the comment docs.

tustvold commented 4 years ago

The parser on master doesn't handle lines with unterminated ' or ", except where enclosed in a terminated block of the other character

For example:

KEY=asd'f => ERROR
KEY=asd'f' => asdf
KEY=asd'f'" => ERROR
KEY=asd'f'"a" => asdfa
KEY=asd'f"' => asdf"
KEY=1'2'3' => ERROR
KEY=1'2'3'4' => 1234

So this shouldn't break anything that was previously working

The implementation provided in this PR won't handle cases such as below, but I'm not sure people would expect it to

KEY='sdfsdf'"sdf
sdfsd"

On a related note, whilst experimenting I found that the parser on master doesn't handle escapes within ' which might be a bug?

KEY='\'' => ERROR
KEY="\"" => "
hoijui commented 2 years ago

superseded by https://github.com/allan2/dotenvy/pull/3