Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix URI escaping of spaces in push.rb
When `URI.escape` was deprecated, we switched to using `CGI.escape` to construct the request path in push.rb. The problem with that is that it mishandles spaces, encoding them as `+` rather than `%20`. This leads to literal `+` characters in metric labels, which is a bug. This commit uses `ERB::Util.url_encode` instead, which gives us the behaviour we want. It's not the part of the standard library I expected to use for this, but it's the only one that seems to have the behaviour we want and that hasn't disappeared in Ruby 3.0. `WEBrick::HTTPUtils.escape` seems similar on the surface, but doesn't encode `&`. Presumably it's intended as a best-effort way to encode an entire URL, and has to assume that any `&` character is a separator between query params.
- Loading branch information