Skip to content

Commit b1395ca

Browse files
committed
refactors url sanitizer to fix bug where it removs multiple include parameters
1 parent d17f67c commit b1395ca

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/java_buildpack/util/sanitizer.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ def handle_params(params)
3636

3737
query_params = ''
3838

39-
params.each do |key, _|
40-
params[key] = '***' if key.match(keywords)
41-
query_params += key + '=' + params[key] + '&'
39+
params.split("&").each do |single_param|
40+
k, v = single_param.split("=")
41+
if k.match(keywords)
42+
v = "***"
43+
end
44+
query_params += k + '=' +v + '&'
4245
end
43-
4446
query_params
4547
end
4648

@@ -53,8 +55,7 @@ def sanitize_uri
5355
rich_uri.password = nil
5456

5557
if rich_uri.query
56-
params = (URI.decode_www_form rich_uri.query).to_h
57-
query_params = handle_params(params)
58+
query_params = handle_params(rich_uri.query)
5859
rich_uri.query = query_params.chop
5960
end
6061

0 commit comments

Comments
 (0)