Skip to content

Commit a40cec2

Browse files
Escape regex match in highlight function to prevent errors (#156)
1 parent ec10e84 commit a40cec2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/oban/web/live/search_component.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ defmodule Oban.Web.SearchComponent do
196196
|> List.last()
197197

198198
if is_binary(value) and is_binary(match) do
199-
pattern = Regex.compile!("(#{match})", "i")
199+
pattern = Regex.compile!("(#{Regex.escape(match)})", "i")
200200

201201
value
202202
|> String.replace(pattern, "<b>\\1</b>")

0 commit comments

Comments
 (0)