-
Notifications
You must be signed in to change notification settings - Fork 41
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
make quoted capture less greedy when we have unambiguous separator #62
make quoted capture less greedy when we have unambiguous separator #62
Conversation
In [logstash-plugins#60][], GitHub user @robcowart reports that in some scenarios we can fail to split on match of `field_split_pattern`. The example given is a partially-quoted value, with additional bytes between it and the unambiguous separator, followed by another key and quoted value. Since the quoted value isn't immediately followed by a field splitter, our semi-greedy quoted-value capture was too greedy, continuing to consume until it found a close-quote that would be followed by either a field-split or EOF. Here, we become much less greedy, capturing any sequence of characters that is _not_ the close-quote character. [logstash-plugins#60]: logstash-plugins#60
CI failing because of elastic/logstash-devutils#73 |
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.
left a tiny minor spec structure suggestion
I tested a few cases manually and confirmed lib changes solve the new specs
LGTM
spec/filters/kv_spec.rb
Outdated
} | ||
} | ||
|
||
context '' do |
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.
since there's no context here, can we just move the it
block one level back?
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.
d'oh, will fix this and do the merge on Monday.
9646eb5
to
21eee81
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
…racters Closes: logstash-plugins#52 Resolves: logstash-plugins#59
21eee81
to
5be7b60
Compare
expect(event.get("foo")).to eq('bar') | ||
expect(event.get("baz")).to eq('"quoted stuff" and more unquoted') | ||
expect(event.get("msg")).to eq('fully-quoted with a part! of the separator') | ||
expect(event.get("blip")).to eq('this!!!!!is it') |
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.
❤️
This looks good. |
This PR contains a couple separate fixes, that rely on each other; each fix is
documented in its own separate commit, but the commits must be applied in
order.
Greediness of Quoted Values
Greediness of
trim_key
andtrim_value
operations