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

Allow equal signs (=) in values #21

Closed
wants to merge 2 commits into from
Closed

Allow equal signs (=) in values #21

wants to merge 2 commits into from

Conversation

izolate
Copy link
Contributor

@izolate izolate commented Oct 29, 2019

Hi @mockturtl,

This PR fixes a bug that prevents the parser from correctly parsing values that contain equal signs (=).

The problem is caused by performing a string split on every occurrence of the equal sign character, which causes the unintended side effect of also splitting the value of the variable.

Example

A base64 encoded string will often end with an equal sign due to padding. For example, the string "foo" is encoded as "Zm9vCg==", but incorrectly parsed by this library:

// FOO="Zm9vCg=="
print(dotenv.env['FOO']); // "Zm9vCg"

Note the missing == signs. The fix contained in this PR allows the correct parsing of the variable as Zm9vCg==.

Thanks, I hope you get a chance to review and merge this PR soon.

mockturtl pushed a commit that referenced this pull request Oct 29, 2019
@mockturtl
Copy link
Owner

Looks great, thanks!

@mockturtl
Copy link
Owner

Merged in #22.

@mockturtl mockturtl closed this Oct 29, 2019
@mockturtl
Copy link
Owner

Shipped.

https://pub.dev/packages/dotenv

@izolate izolate deleted the fix-string-split branch October 30, 2019 04:22
@izolate
Copy link
Contributor Author

izolate commented Oct 30, 2019

Thanks for the fast response!

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 this pull request may close these issues.

2 participants