Skip to content

Commit

Permalink
Replace URI decode with CGI unescape (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophieyfang authored Jan 3, 2023
1 parent 11c1413 commit 7c3ba75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/plugin/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require 'mocha/test_unit'
require 'prometheus/client'
require 'webmock/test_unit'
require 'cgi'

require_relative 'asserts'
require_relative 'constants'
Expand Down Expand Up @@ -823,7 +824,7 @@ def test_reject_non_utf8_container_name_with_require_valid_tags_true
params = CONTAINER_FROM_METADATA_PARAMS.merge(
labels: CONTAINER_FROM_METADATA_PARAMS[:labels].merge(
"#{GKE_CONSTANTS[:service]}/container_name" =>
URI.decode(encoded_name)),
CGI.unescape(encoded_name)),
log_name: encoded_name)
verify_log_entries(0, params, 'textPayload')
end
Expand Down Expand Up @@ -906,7 +907,7 @@ def test_sanitize_tags_from_container_name_with_require_valid_tags_false
params = CONTAINER_FROM_METADATA_PARAMS.merge(
resource: CONTAINER_FROM_METADATA_PARAMS[:resource].merge(
labels: CONTAINER_FROM_METADATA_PARAMS[:resource][:labels].merge(
'container_name' => URI.decode(encoded_container_name))),
'container_name' => CGI.unescape(encoded_container_name))),
log_name: encoded_container_name)
verify_log_entries(1, params, 'textPayload')
end
Expand Down

0 comments on commit 7c3ba75

Please sign in to comment.