outputs/warp10: url encode comma in tags value#8657
outputs/warp10: url encode comma in tags value#8657ivorybilled merged 1 commit intoinfluxdata:masterfrom
Conversation
plugins/outputs/warp10/warp10.go
Outdated
| value := strings.Replace(tag.Value, ",", "%2C", -1) | ||
| tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) |
There was a problem hiding this comment.
What do you think about query escaping this with the same function used for URL encoding, so all special characters are handled? you could do this for the tag key as well.
| value := strings.Replace(tag.Value, ",", "%2C", -1) | |
| tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) | |
| value := url.QueryEscape(tag.Value) | |
| tagsString[index] = fmt.Sprintf("%s=%s", tag.Key, value) |
There was a problem hiding this comment.
Mh, it might be better indeed. After looking again at the Warp10 specification, it seems that both tag key and value should be url encoded, I just didn't encounter an issue with it. But at the same time, most of the characters would be fine, only ,, { and } would be a real issue.
I think I'll adapt your commit to url encode the key too, would that be okay? Or I can commit your changes if you prefer to do it.
There was a problem hiding this comment.
I guess both is fine for @ssoroka. Will remove the "ready-to-merge" label and wait for your changes... :-) Thanks for taking care of this!
There was a problem hiding this comment.
Alright, I'll make the changes withing a few days, thanks :)
0d429ad to
822c846
Compare
822c846 to
0c45935
Compare
|
I rebased this branch onto master and I amended the commit to also url encode the tag key. Let me know if there is anything else I should do. |
(cherry picked from commit f09e551)
Hello,
The warp10 specification requires the commas in tag values to be URL encoded as
%2C. This PR fixes this behavior.I'm not very familiar with Golang, let me know if there is anything I should do better.
EDIT: Without this, Warp10 will reject the input and reply a parse error. This is the case with the current Elasticsearch input plugin for example.
Required for all PRs: