Skip to content

Commit

Permalink
Add a comment which describes why we use String#gsub to replace spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmo0920 committed Jan 20, 2020
1 parent a5fa046 commit bba1a63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fluent/config/v1_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def parse_include(attrs, elems)
end

def eval_include(attrs, elems, uri)
u = URI.parse(uri.gsub(/ /, '+')) # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
# 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
# When the Windows absolute path then u.scheme.length == 1
# e.g. C:
Expand Down

0 comments on commit bba1a63

Please sign in to comment.