From 277adbed8e8f8f553256fe7f828c29b8f669b9fb Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Mon, 1 Nov 2021 09:59:20 -0400 Subject: [PATCH] Escape the backslash in the string (#15232) This ensures it's rendered in the pattern regex field in the browser. Without "\\w" -> "\w" we get "\w" ->"w" and only urls starting with www are accepted by the matcher. --- app/views/admin/navigation_links/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/navigation_links/_form.html.erb b/app/views/admin/navigation_links/_form.html.erb index 002258beb..7cb9c22e8 100644 --- a/app/views/admin/navigation_links/_form.html.erb +++ b/app/views/admin/navigation_links/_form.html.erb @@ -5,7 +5,7 @@
<%= form.label :url %> - <%= form.text_field :url, class: "form-control", pattern: "^(https?:\/\/|\/)\w+\.[^\s]+$|^\/[^\s]*$", title: "The URL can be absolute by beginning with http/s or it can be relative beginning with a /", required: true %> + <%= form.text_field :url, class: "form-control", pattern: "^(https?:\/\/|\/)\\w+\.[^\s]+$|^\/[^\s]*$", title: "The URL can be absolute by beginning with http/s or it can be relative beginning with a /", required: true %>
A full (external) or relative (internal) URL for the link