mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Sidekiq Web: If text contains invalid byte sequence, replace them instead of raising an exception
This commit is contained in:
parent
7c22a1deb5
commit
318f4eb719
1 changed files with 4 additions and 0 deletions
|
@ -160,6 +160,10 @@ module Sidekiq
|
|||
|
||||
def h(text)
|
||||
::Rack::Utils.escape_html(text)
|
||||
rescue ArgumentError => e
|
||||
raise unless e.message.eql?('invalid byte sequence in UTF-8')
|
||||
text.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '').encode!('UTF-8', 'UTF-16')
|
||||
retry
|
||||
end
|
||||
|
||||
# Any paginated list that performs an action needs to redirect
|
||||
|
|
Loading…
Add table
Reference in a new issue