bugsnag 2.8.4 → 2.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/VERSION +1 -1
  4. data/lib/bugsnag/helpers.rb +13 -13
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98754bef4fe1a80b60181d175224dc46b9fa8513
4
- data.tar.gz: c430fa486e7d64d9711797fc6a019fec38c442b4
3
+ metadata.gz: c82e8e7e46403a193b059ff577ea4b7808ab2f82
4
+ data.tar.gz: 12c42851511672d1a2209fc6c46effbef3447e6f
5
5
  SHA512:
6
- metadata.gz: 58eb4aebb5a8c8cc4c09b9d6cfe145616ba528923c36b5e2439198cfc42b77bb14367aadf108e7af4ca18e873c4a91a5f356fbe2408916596006211e9134e82d
7
- data.tar.gz: 86d9e6a36a7a2e44a1f9af847b8637f313370a49ee0a730799f99191854fdfcd78240d27c1210d1ee71b45d8bbd17f6a1ce7c9da05c4ca540d2a0078b2e909b2
6
+ metadata.gz: 4ee30f99540b90d2d898bc8037e2ce2f534a52ca30c8d57ecff9313557c6af717a90c691ac781cfad56af133b6ad0ae7a5a4eff46b4579ebba7881c52333a14f
7
+ data.tar.gz: 227828a21ae4cf499392bc41c44639db5f6decf7d9515c46a4363d809b4b5e9256af4d3f3f66a5628d16ab9b2aa3ffc516b8f7afe6807d84a32ab165ba67e4de
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.8.5
5
+ -----
6
+
7
+ - Fix performance problems in cleanup_obj
8
+
9
+
4
10
  2.8.4
5
11
  -----
6
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.4
1
+ 2.8.5
@@ -3,26 +3,23 @@ require 'uri'
3
3
  module Bugsnag
4
4
  module Helpers
5
5
  MAX_STRING_LENGTH = 4096
6
+ ENCODING_OPTIONS = {:invalid => :replace, :undef => :replace}.freeze
6
7
 
7
- def self.cleanup_obj(obj, filters = nil, seen=Set.new)
8
+ def self.cleanup_obj(obj, filters = nil, seen = {})
8
9
  return nil unless obj
9
10
 
10
11
  # Protect against recursion of recursable items
11
- if obj.is_a?(Hash) || obj.is_a?(Array) || obj.is_a?(Set)
12
- return "[RECURSION]" if seen.include? obj
13
-
14
- # We duplicate the seen set here so that no updates by further cleanup_obj calls
15
- # are persisted beyond that call.
16
- seen = seen.dup
17
- seen << obj
12
+ protection = if obj.is_a?(Hash) || obj.is_a?(Array) || obj.is_a?(Set)
13
+ return seen[obj] if seen[obj]
14
+ seen[obj] = '[RECURSION]'.freeze
18
15
  end
19
16
 
20
- case obj
17
+ value = case obj
21
18
  when Hash
22
19
  clean_hash = {}
23
20
  obj.each do |k,v|
24
21
  if filters_match?(k, filters)
25
- clean_hash[k] = "[FILTERED]"
22
+ clean_hash[k] = '[FILTERED]'.freeze
26
23
  else
27
24
  clean_obj = cleanup_obj(v, filters, seen)
28
25
  clean_hash[k] = clean_obj
@@ -39,19 +36,22 @@ module Bugsnag
39
36
  str = obj.to_s
40
37
  # avoid leaking potentially sensitive data from objects' #inspect output
41
38
  if str =~ /#<.*>/
42
- '[OBJECT]'
39
+ '[OBJECT]'.freeze
43
40
  else
44
41
  cleanup_string(str)
45
42
  end
46
43
  end
44
+
45
+ seen[obj] = value if protection
46
+ value
47
47
  end
48
48
 
49
49
  def self.cleanup_string(str)
50
50
  if defined?(str.encoding) && defined?(Encoding::UTF_8)
51
51
  if str.encoding == Encoding::UTF_8
52
- str.valid_encoding? ? str : str.encode('utf-16', {:invalid => :replace, :undef => :replace}).encode('utf-8')
52
+ str.valid_encoding? ? str : str.encode('utf-16', ENCODING_OPTIONS).encode('utf-8')
53
53
  else
54
- str.encode('utf-8', {:invalid => :replace, :undef => :replace})
54
+ str.encode('utf-8', ENCODING_OPTIONS)
55
55
  end
56
56
  elsif defined?(Iconv)
57
57
  Iconv.conv('UTF-8//IGNORE', 'UTF-8', str) || str
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.4
4
+ version: 2.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json