lib/raven/processor/utf8conversion.rb in sentry-raven-3.0.0 vs lib/raven/processor/utf8conversion.rb in sentry-raven-3.0.1
- old
+ new
@@ -12,10 +12,11 @@
!value.frozen? ? value.merge!(value) { |_, v| process v } : value.merge(value) { |_, v| process v }
when Array
!value.frozen? ? value.map! { |v| process v } : value.map { |v| process v }
when Exception
return value if value.message.valid_encoding?
+
clean_exc = value.class.new(remove_invalid_bytes(value.message))
clean_exc.set_backtrace(value.backtrace)
clean_exc
when String
# Encoding::BINARY / Encoding::ASCII_8BIT is a special binary encoding.
@@ -25,9 +26,10 @@
if value.encoding == Encoding::BINARY && !value.ascii_only?
value = value.dup
value.force_encoding(Encoding::UTF_8)
end
return value if value.valid_encoding?
+
remove_invalid_bytes(value)
else
value
end
end