-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 issue with parsing #1183
Fix issue with parsing #1183
Conversation
1 similar comment
Issue was if there is a ] inside one of the values of a list. The end character would get removed. So something like ``foo=[bar, *[biz]*, bar]`` would get parsed to ``foo=bar,*[biz],bar``.
@@ -85,7 +85,7 @@ def _eat_items(value, iter_parts, part, end_char, replace_char=''): | |||
except StopIteration: | |||
raise ValueError(value) | |||
chunks.append(current.replace(replace_char, '')) | |||
if end_char in current: | |||
if end_char == current[-1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't the line above replace some (and potentially all) characters with a blank? What happens when current
is ''
and we do the current[-1]
check? May want to check for that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielgtaylor How does using endswith() sound?
26453f0
to
248d917
Compare
Thanks. 🚢-it! |
Issue was if there is a ] inside one of the values of a list, the end character would get removed. So something like
foo=[bar, *[biz]*, bar]
would get parsed tofoo=bar,*[biz],bar
. To get that to work, you would have to use escape characters.Note that we still run into the issue where the argument is
foo=[bar,[biz],bar]
, it will be translated tofoo=bar,[biz,bar
and the escape character would need to be used to get the correct format. To fix that, that will take a much larger change in how we parse input.cc @jamesls @danielgtaylor