Skip to content

Commit

Permalink
Use uri.gsub(' ', '+') method instead of URI.encode_www_form_components
Browse files Browse the repository at this point in the history
Because raw URI.encode_www_form_components methods overescape for passed string in this case.
We just need to handle URI with spaces as valid URI.
TO acheive this, we just replace spaces with '+' before executing URI.parse.

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jan 18, 2020
1 parent aacecdf commit 0c5f6ba
Showing 1 changed file with 2 additions and 2 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 @@ -147,8 +147,8 @@ def parse_include(attrs, elems)
end

def eval_include(attrs, elems, uri)
u = URI.parse(URI.encode_www_form_component(uri))
if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == URI.encode_www_form_component(uri) # file path
u = URI.parse(uri.gsub(' ', '+')) # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.gsub(' ', '+') # 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

0 comments on commit 0c5f6ba

Please sign in to comment.