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

Lists of quoted strings containing semicolons are not being parsed properly #81

Open
GreenGremlin opened this issue Jul 30, 2018 · 2 comments

Comments

@GreenGremlin
Copy link

Here's a simple reproduction of this Issue:

const iniParser = require('ini');

console.log(iniParser.parse('values=["foo; bar"]'));

Actual result:

Semicolon's in a quoted string in a list are parsed as a comment.

{ values: '["foo' }

Expected result:

Semicolon's in a quoted string should not be parsed as a comment.

{ values: ['foo; bar'] }
  • ini version: 1.3.5
  • node version: 8.9.4
@GreenGremlin
Copy link
Author

GreenGremlin commented Jul 31, 2018

Honestly, I'm not too familiar with the ini format. Looking around, it sounds like the MS implementation does not support end of line comments, but other ini implementations do support it. It would be nice if this library had the option to disable end of line comments.

In the meantime, it looks like I can get by using a regex to escape semicolon's that are not at the start of a line.

const iniStr = 'values=["foo; bar"]';
console.log(iniParser.parse(iniStr.replace(/([\S] *);/g, '$1\\;')));

@m417z
Copy link

m417z commented Mar 17, 2022

This is similar to #142. You can try my fork, ini-win, which aims to be more compatible with the way Windows handles ini files. Windows only supports whole line comments, and so does my fork, so it fixes this issue.

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

No branches or pull requests

2 participants