Skip to content

Commit

Permalink
rubocop: Use tr instead of gsub
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Menges <[email protected]>
  • Loading branch information
Garfield96 committed Jun 20, 2023
1 parent fc3389d commit 21ca454
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/config/v1_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def parse_include(attrs, elems)
def eval_include(attrs, elems, uri)
# replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
# See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
u = URI.parse(uri.gsub(/ /, '+'))
if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.gsub(/ /, '+') # file path
u = URI.parse(uri.tr(' ', '+'))
if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.tr(' ', '+') # file path
# When the Windows absolute path then u.scheme.length == 1
# e.g. C:
path = URI.decode_www_form_component(u.path)
Expand Down
4 changes: 2 additions & 2 deletions lib/fluent/plugin/in_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def on_headers_complete(headers)
@content_type = ""
@content_encoding = ""
headers.each_pair {|k,v|
@env["HTTP_#{k.gsub('-','_').upcase}"] = v
@env["HTTP_#{k.tr('-','_').upcase}"] = v
case k
when /\AExpect\z/i
expect = v
Expand Down Expand Up @@ -585,7 +585,7 @@ def on_message_complete
query_params = WEBrick::HTTPUtils.parse_query(uri.query)

query_params.each_pair {|k,v|
params["QUERY_#{k.gsub('-','_').upcase}"] = v
params["QUERY_#{k.tr('-','_').upcase}"] = v
}
end

Expand Down

0 comments on commit 21ca454

Please sign in to comment.