lib/fluent/plugin/out_string_scrub.rb in fluent-plugin-string-scrub-0.0.3 vs lib/fluent/plugin/out_string_scrub.rb in fluent-plugin-string-scrub-0.0.4

- old
+ new

@@ -75,10 +75,14 @@ begin string =~ // return string rescue ArgumentError => e raise e unless e.message.index("invalid byte sequence in") == 0 - string.scrub!(@replace_char) + if string.frozen? + string = string.dup.scrub!(@replace_char) + else + string.scrub!(@replace_char) + end retry end end end