Commit c8a581fb3181e776b5c645f7481337a9a7d83d68

Authored by Andrew
1 parent 47127913
Exists in routing_queue

Escape data [skip ci]

lib/searchkick/process_batch_job.rb
... ... @@ -4,7 +4,7 @@ module Searchkick
4 4  
5 5 def perform(class_name:, record_ids:)
6 6 # separate routing from id
7   - routing = Hash[record_ids.map { |r| r.split("|", 2) }]
  7 + routing = Hash[record_ids.map { |r| r.split("|").map { |v| CGI.unescape(v) } }]
8 8 record_ids = routing.keys
9 9  
10 10 klass = class_name.constantize
... ...
lib/searchkick/record_indexer.rb
... ... @@ -26,10 +26,8 @@ module Searchkick
26 26 routing = record.search_routing
27 27 end
28 28  
29   - # TODO before merge
30   - # escape separator character
31   - value = record.id.to_s
32   - value = "#{value}|#{routing}" if routing
  29 + value = CGI.escape(record.id.to_s)
  30 + value = "#{value}|#{CGI.escape(routing)}" if routing
33 31 index.reindex_queue.push(value)
34 32 when :async
35 33 unless defined?(ActiveJob)
... ...