npm / ini

An ini parser/serializer in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Quotes are getting added to the value if it contains spaces.

shishiranshuman opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

After writing the contents back to the file, the quotes are added to the values that have spaces.

For instance, the following contents of the file is read:

credential_process = /opt/bin/awscreds-custom --username helen

And after writing the contents back to the file, this is how it looks:

credential_process = "/opt/bin/awscreds-custom --username helen"

I used the AWS config file as an example.

Expected Behavior

The quotes must not be added to the values.

Steps To Reproduce

  1. Create a file with some key-value pairs. Make sure to add multiple words or spaces to the values.
  2. Parse the file contents using ini.parse()
  3. Now, write the same file contents back to the file. Use ini.stringify() to encode.

Environment

  • npm: 8.14.0
  • Node: 16.16.0
  • OS: macOS Monterey 12.4
  • platform: Macbook Pro
  • ini: 3.0.0

Running into same issue.
Can we get this changed? Or perhaps an option could be added to EncodeOptions to control behavior?

commented

This is not a bug this is intentional. If someone wants to submit a PR to add a flag (like #58 but with tests) they are welcome to.