fluent-plugin-string-scrub 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdab445162d666c325c977971529e5eb25a4ffc0
4
- data.tar.gz: f7eeafe31bdaf17e838db80b51e232167391ce31
3
+ metadata.gz: 73d0da5e8e95386a46ed8d332e3ad698448b2c5f
4
+ data.tar.gz: 64bd7f44ed8164404d4793c6c947f8dff9cd86ab
5
5
  SHA512:
6
- metadata.gz: f850bc87770dcec1b61e92392bf7f2ba075cbbea2782c0e8a1b9b8cb65b90c7977ac1868c1500a35efeba272045606b1e9fc7842990823c443f2d2821312ffb6
7
- data.tar.gz: 3f8e0e2d4d51811b69cef252a55d18a635d151794716b04661d55537138b17e1b6ab6e523272e1103a0f63bfe7089492c1103159f845e1589a68a7ca6362584a
6
+ metadata.gz: c960490269222cdc16e9ce8d5c1addd1747436b73ed0cc9ef099c0d33989ec148cf9f133620b03f25cb9d070a996ec9dfff110b61f3e71891ae870be56d23aeb
7
+ data.tar.gz: 0b1443b6c15cd8ae04915f73230ca9287a2b0b033c266a446ad97eaa958ac488c07095d3336e8b43f6b99ce89e434ef85ab004e8fe908bf5f4d8ebf420560d0f
@@ -3,7 +3,7 @@ lib = File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-string-scrub"
6
- spec.version = "0.0.3"
6
+ spec.version = "0.0.4"
7
7
  spec.authors = ["Noriaki Katayama"]
8
8
  spec.email = ["kataring@gmail.com"]
9
9
  spec.summary = %q{Fluentd Output filter plugin.}
@@ -77,7 +77,11 @@ class Fluent::StringScrubOutput < Fluent::Output
77
77
  return string
78
78
  rescue ArgumentError => e
79
79
  raise e unless e.message.index("invalid byte sequence in") == 0
80
- string.scrub!(@replace_char)
80
+ if string.frozen?
81
+ string = string.dup.scrub!(@replace_char)
82
+ else
83
+ string.scrub!(@replace_char)
84
+ end
81
85
  retry
82
86
  end
83
87
  end
@@ -174,4 +174,31 @@ class StringScrubOutputTest < Test::Unit::TestCase
174
174
  assert_equal "scrubbed.log", e1[0]
175
175
  assert_equal orig_message + "\uFFFD".force_encoding('UTF-8'), e1[2]['message']['message_child']
176
176
  end
177
+
178
+ def test_emit5_frozen_string
179
+ orig_message = 'testtesttest'
180
+ invalid_utf8 = "\xff".force_encoding('UTF-8')
181
+ d1 = create_driver(CONFIG, 'input.log')
182
+ d1.run do
183
+ d1.emit({'message' => (orig_message + invalid_utf8).freeze})
184
+ end
185
+ emits = d1.emits
186
+ assert_equal 1, emits.length
187
+
188
+ e1 = emits[0]
189
+ assert_equal "scrubbed.log", e1[0]
190
+ assert_equal orig_message, e1[2]['message']
191
+
192
+ invalid_ascii = "\xff".force_encoding('US-ASCII')
193
+ d2 = create_driver(CONFIG, 'input.log2')
194
+ d2.run do
195
+ d2.emit({'message' => (orig_message + invalid_utf8).freeze})
196
+ end
197
+ emits = d2.emits
198
+ assert_equal 1, emits.length
199
+
200
+ e2 = emits[0]
201
+ assert_equal "scrubbed.log2", e2[0]
202
+ assert_equal orig_message, e2[2]['message']
203
+ end
177
204
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-string-scrub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noriaki Katayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake