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
Support '|' in path #189
Support '|' in path #189
Conversation
Using '|' as the data separator caused crashes if a path with a '|' char in it was in the data file. Changing that separator to a null byte ensures that this kind of issue can never happen again as the null byte can't be in a path.
f623c92
to
924f61a
Compare
I rebased the branch onto master. |
The original format is compatible with z.sh, I believe a lot of users may benefit from this PR,
Some possible options:
|
Thanks for the feedback. I didn't thought about migration so I definitively need to fix that. Option 2 seems the most sensible to me so I will go with it. |
Turns out changing the separator is not needed. Improving the reading function is enough to fix the bugs and crashes with pipes in filenames. |
A smarter reading function lets us support '|' in filenames whilst still using it as the database separator.
2479533
to
cb4c9d3
Compare
I like this solution, no need to convert the old data, the second argument of Lines 138 to 152 in 3022099
is it enough to just use local part = string.split(line, '|', 3) ?? |
Using the second argument of the split function merges the not split part at the end of the input and not at the start like we want. line = "path|with|a|lot|of|pipes|1212|9999"
line:split("|", 3)) --> {"path", "with", "a", "lot|of|pipes|1212|9999"} |
got it, thank you for this PR |
Using '|' as the data separator caused crashes if
a path with a '|' char in it was in the data file. Changing that separator to a null byte ensures
that this kind of issue can never happen again as
the null byte can't be in a path.