Skip to content

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

Open
JulianVennen wants to merge 1 commit into
vanodevium:mainfrom
JulianVennen:prefix-array
Open

Fix parsing arrays with a name that's a prefix of an existing array#6
JulianVennen wants to merge 1 commit into
vanodevium:mainfrom
JulianVennen:prefix-array

Conversation

@JulianVennen

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.

@JulianVennen

Copy link
Copy Markdown
Author

Hey @vanodevium did you have time to look at this yet?

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.

1 participant