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

Empty UnparseableSections is not marked as rawBody #291

Open
frankkopp opened this issue Jun 4, 2021 · 1 comment
Open

Empty UnparseableSections is not marked as rawBody #291

frankkopp opened this issue Jun 4, 2021 · 1 comment

Comments

@frankkopp
Copy link

Describe the bug
When loading an ini with multiple sections with the last section as "UnparsableSection" and this last section is empty then the Section is not marked as rawBody and therefore can not be used to write raw data to.
It works well when at least one line of data is in the section.

To Reproduce
Loading:
tmpIni, err := ini.LoadSources(ini.LoadOptions{ UnparseableSections: []string{"customData"}, }, *c.IniFileName)

INI-file:
[customData]
image

Same code but with at least one line in the section:
image

Expected behavior
Every section marked with UnparseableSections should be a "rawBody" section. Even if it is empty

Screenshots
See above

@frankkopp
Copy link
Author

Here is the piece in your code were it goes wrong:
image

The line 481: section.isRawSection = true is only executed after reading the the next line. If the file is at it's end it will never be set.

Maybe move this line as per my suggestion in the screenshot?

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

1 participant