Skip to content
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

Regression in 2.3 : new parsing of multiline values breaks other things #341

Closed
zarqman opened this issue Apr 23, 2018 · 4 comments · Fixed by #340
Closed

Regression in 2.3 : new parsing of multiline values breaks other things #341

zarqman opened this issue Apr 23, 2018 · 4 comments · Fixed by #340

Comments

@zarqman
Copy link

zarqman commented Apr 23, 2018

Commit aaabca8 (PR #318 - parse multiline values), which is part of dotenv v2.3.0, causes a significant regression in parsing, affecting both commented lines and lines ending in equals.

Steps to reproduce

Consider this sample .env file (./sampleenv):

PORT=3000
RACK_ENV=development
# RAILS_MAX_THREADS=2
#WEB_CONCURRENCY=
CLUSTER=d1

# NS1=d1_
# NS2=
# NS3=d3_
# NS4=d4_

APP_ID=
APP_KEY=abcd

Expected behavior

Gemfile:
gem 'dotenv', github: 'bkeepers/dotenv', ref: 'b44474f'

Before aaabca8:

Dotenv.load('sampleenv')
# => {"PORT"=>"3000", "RACK_ENV"=>"development", "CLUSTER"=>"d1", "APP_ID"=>"", "APP_KEY"=>"abcd"}

Actual behavior

Gemfile:
gem 'dotenv', github: 'bkeepers/dotenv', ref: 'aaabca8'

After aaabca8:

Dotenv.load('sampleenv')
# => {"PORT"=>"3000", "RACK_ENV"=>"development", "WEB_CONCURRENCY"=>"CLUSTER=d1", "NS2"=>"", "NS4"=>"d4_", "APP_ID"=>"APP_KEY=abcd"}

As you can see, multiline is causing any line to eat the '#' at the beginning of the next line, causing that line to be treated as uncommented.

Additionally, any line ending in = ends up wrapping to the next line instead of returning an empty value as it did previously.

System configuration

dotenv 2.3.0
rails 5.2.0
ruby 2.5.1

@zarqman
Copy link
Author

zarqman commented Apr 23, 2018

Sorry, somewhat duplicates #336 and #339.

Leaving open for the moment because it adds more complete examples, but feel free to close if that's not helpful.

@jonmagic
Copy link
Collaborator

Thank you for the bug report. Looking into potential solutions now.

@jonmagic
Copy link
Collaborator

We just shipped version 2.4.0 which removes the Parse multiline values support added in 2.3.0 and fixes the parsing regressions.

@zarqman
Copy link
Author

zarqman commented Apr 24, 2018

thanks for the super quick resolution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants