Skip to content

Commit 40b758b

Browse files
committed
Remove mail objects from ActionMailer events
Fixes #663
1 parent 5e3b21e commit 40b758b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/honeybadger/notification_subscriber.rb

+13
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ def format_payload(payload)
133133
end
134134

135135
class ActionMailerSubscriber < NotificationSubscriber
136+
def format_payload(payload)
137+
# Don't include the mail object in the payload...
138+
mail = payload.delete(:mail)
139+
140+
# ... but do include any attachment filenames
141+
attachment_info = if mail&.attachments&.any?
142+
{ attachments: mail.attachments.map { |a| { filename: a.filename } } }
143+
else
144+
{}
145+
end
146+
147+
payload.merge(attachment_info)
148+
end
136149
end
137150

138151
class ActiveStorageSubscriber < NotificationSubscriber

0 commit comments

Comments
 (0)