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

The parse() does not handle keys with JSON values containing double-quotes #229

Closed
kamyar-nemati opened this issue Nov 29, 2023 · 4 comments · Fixed by #234
Closed

The parse() does not handle keys with JSON values containing double-quotes #229

kamyar-nemati opened this issue Nov 29, 2023 · 4 comments · Fixed by #234
Labels
bug Broken or unexpected

Comments

@kamyar-nemati
Copy link

kamyar-nemati commented Nov 29, 2023

Given the ENV file below:

---env begins here---

APP_NAME=FooBar
APP_COMM_CRED="[{"key":"foo"},{"key":"bar"}]"

---env ends here---

The JSON value of APP_COMM_CRED is deformed and the "key" attributes lose their double-quotes after performing the parse function.

@balupton balupton added the bug Broken or unexpected label Nov 29, 2023
@balupton
Copy link
Member

Interesting.

Seems that envfile should use https://github.com/bevry/normalify then.

Happy for you to send a PR.

I do have to merge #213 sometime as well.

@balupton
Copy link
Member

@NamPNQ in your opinion, would https://github.com/bevry/normalify be suitable for this?

@NamPNQ
Copy link
Contributor

NamPNQ commented Mar 13, 2024

I think we can handle by just check value.startsWith() && value.endsWith() by double quote, or single quote, then we get substring of value

@NamPNQ
Copy link
Contributor

NamPNQ commented Mar 13, 2024

@NamPNQ in your opinion, would https://github.com/bevry/normalify be suitable for this?

IMO, use this will make unexpected behavior, because env value is always is string, not number nor boolean

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

Successfully merging a pull request may close this issue.

3 participants