Skip to content

Commit

Permalink
Merge pull request #309 from airbrake/308-filter-crash-fix
Browse files Browse the repository at this point in the history
filters/keys_filter: handle non-hash values
  • Loading branch information
kyrylo authored Mar 12, 2018
2 parents e57de2d + 0773bd6 commit 9ec9ba3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Airbrake Ruby Changelog

### master

* Fixed bug introduced in v2.8.2 in blacklist/whitelist filtering. All
v2.8.2 users must upgrade to the recent version
([#309](https://github.com/airbrake/airbrake-ruby/pull/309))

### [v2.8.2][v2.8.2] (March 5, 2018)

* Fixed bug where params inside arrays couldn't be
Expand Down
2 changes: 2 additions & 0 deletions lib/airbrake-ruby/filters/keys_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def should_filter?(_key)
private

def filter_hash(hash)
return hash unless hash.is_a?(Hash)

hash.each_key do |key|
if should_filter?(key.to_s)
hash[key] = FILTERED
Expand Down
4 changes: 2 additions & 2 deletions spec/filters/keys_blacklist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
'pattern matching',
['bingo'],
[
{ array: [bingo: 'bango'] },
{ array: [bingo: '[Filtered]'] }
{ array: [{ bingo: 'bango' }, []] },
{ array: [{ bingo: '[Filtered]' }, []] }
]
)
end
Expand Down

0 comments on commit 9ec9ba3

Please sign in to comment.