Skip to content

Commit

Permalink
Modifying the recursive sprintf map to be similar to the current impl…
Browse files Browse the repository at this point in the history
…ementation
  • Loading branch information
idrisskettereruserlane committed Dec 12, 2019
1 parent 6ff821d commit b9d21ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/logstash/outputs/slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def register
def recursive_sprintf(event, node)
case node
when String
node = event.sprintf(node)
node = JSON.parse(event.sprintf(JSON.dump(node)))
when Array
node.map! do |obj|
recursive_sprintf( event, obj )
Expand Down Expand Up @@ -78,7 +78,8 @@ def receive(event)
end

if @attachments and @attachments.any?
payload_json['attachments'] = recursive_sprintf(event , @attachments)
payload_json['attachments'] = @attachments.map { |x| recursive_sprintf(event, x) }
# payload_json['attachments'] = recursive_sprintf(event , @attachments)
end
if event.include?('attachments') and event.get('attachments').is_a?(Array)
if event.get('attachments').any?
Expand Down

0 comments on commit b9d21ac

Please sign in to comment.