From 6d975ebe11d6dab3d5c4f5ae3d7d680731470993 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 16 Jan 2020 13:39:38 +1100 Subject: [PATCH] fix: correct logic for finding pacticipants by name when the name contains an underscore --- lib/pact_broker/repositories/helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pact_broker/repositories/helpers.rb b/lib/pact_broker/repositories/helpers.rb index 4ec00a021..8fc873d6b 100644 --- a/lib/pact_broker/repositories/helpers.rb +++ b/lib/pact_broker/repositories/helpers.rb @@ -10,12 +10,12 @@ def name_like column_name, value if PactBroker.configuration.use_case_sensitive_resource_names if mysql? # sigh, mysql, this is the only way to perform a case sensitive search - Sequel.escaped_like(column_name, value) + Sequel.like(column_name, value.gsub("_", "\\_"), { case_insensitive: false }) else { column_name => value } end else - { Sequel.function(:lower, column_name) => value.downcase } + Sequel.like(column_name, value.gsub("_", "\\_"), { case_insensitive: true }) end end