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,7 +4,7 @@ module Searchkick
4 4
5 def perform(class_name:, record_ids:) 5 def perform(class_name:, record_ids:)
6 # separate routing from id 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 record_ids = routing.keys 8 record_ids = routing.keys
9 9
10 klass = class_name.constantize 10 klass = class_name.constantize
lib/searchkick/record_indexer.rb
@@ -26,10 +26,8 @@ module Searchkick @@ -26,10 +26,8 @@ module Searchkick
26 routing = record.search_routing 26 routing = record.search_routing
27 end 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 index.reindex_queue.push(value) 31 index.reindex_queue.push(value)
34 when :async 32 when :async
35 unless defined?(ActiveJob) 33 unless defined?(ActiveJob)