Skip to content

Fix parsing arrays with a name that's a prefix of an existing array - #8

Open
ramzes642 wants to merge 2 commits into
vanodevium:mainfrom
ramzes642:prefix-array
Open

Fix parsing arrays with a name that's a prefix of an existing array#8
ramzes642 wants to merge 2 commits into
vanodevium:mainfrom
ramzes642:prefix-array

Conversation

@ramzes642

Copy link
Copy Markdown

If you have two arrays where the name of the second one is a prefix of the first, like this:

[[fruits]]
name = "banana"

[[fruit]] # prefix of existing array
name = "strawberry"

The library throws an "key duplication" error even though this is valid. If you swap the order of these items, the issue doesn't occur.
This is caused by a missing . in the str_starts_with check in TomlKeystore::addArrayTableNode.

I added that missing dot, added it to the success test and also added a test that verifies that invalid toml is still rejected by this check.

@ramzes642

Copy link
Copy Markdown
Author

Fixed one more corner-case with nested array

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