Skip to content

Commit

Permalink
config: types: Use JSON.parse instead of JSON.load
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hatake@clear-code.com>
  • Loading branch information
cosmo0920 committed Mar 11, 2021
1 parent a8dc1d3 commit 27ed7dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/config/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def self.hash_value(val, opts = {}, name = nil)
return nil if val.nil?

param = if val.is_a?(String)
val.start_with?('{') ? JSON.load(val) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
val.start_with?('{') ? JSON.parse(val) : Hash[val.strip.split(/\s*,\s*/).map{|v| v.split(':', 2)}]
else
val
end
Expand All @@ -213,7 +213,7 @@ def self.array_value(val, opts = {}, name = nil)
return nil if val.nil?

param = if val.is_a?(String)
val.start_with?('[') ? JSON.load(val) : val.strip.split(/\s*,\s*/)
val.start_with?('[') ? JSON.parse(val) : val.strip.split(/\s*,\s*/)
else
val
end
Expand Down

0 comments on commit 27ed7dd

Please sign in to comment.