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

Fix parse issue with consecutive dates #77

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

kiskoza
Copy link
Collaborator

@kiskoza kiskoza commented Jan 2, 2024

Closes #58

The issue was with the offset used for extra_chars_to_be_added. The inserted string is 12 characters long, but the code incremented the offset by only 10 - it should have been 11 (we're replacing 1 char with 12 chars, 12 - 1 = 11).

Why wasn't it a problem? The output variable holds the json with extra spaces added, so it had some space to "correct" itself.

# `output` argument, note the double spaces
'{"first_date":  "2016-01-25",  "second_date":  "2014-01-26",  "third_date":  "2024-01-02"}'
# `output` after the first insert - looks okay
'{"first_date": !!timestamp "2016-01-25",  "second_date":  "2014-01-26",  "third_date":  "2024-01-02"}'
# `output` after the second insert - a bit off, but still valid
'{"first_date": !!timestamp "2016-01-25",  "second_date":!!timestamp  "2014-01-26",  "third_date":  "2024-01-02"}'
# `output` after the third insert - the extra keyword ate the `:` and the json is not valid anymore
'{"first_date": !!timestamp "2016-01-25",  "second_date":!!timestamp  "2014-01-26",  "third_date"!!timestamp   "2024-01-02"}'

There's a green pipeline using my other PR: https://github.com/kiskoza/crack/actions/runs/7386253493

@kiskoza kiskoza merged commit f690844 into jnunemaker:master Jan 26, 2024
15 of 16 checks passed
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.

Crack 0.4.3 cannot parse two consecutive dates
1 participant