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.
This commit is contained in:
Daniel Uber 2021-11-01 09:59:20 -04:00 committed by GitHub
parent 1458b3ef56
commit 277adbed8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@
</div>
<div class="form-group">
<%= 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 %>
<div class="alert alert-info">A full (external) or relative (internal) URL for the link</div>
</div>
<div class="form-group" data-controller="svg-icon-upload">