[Rt-commit] rt branch 5.0/one-time-cc-special-chars created. rt-5.0.5-70-g57976db4e0
BPS Git Server
git at git.bestpractical.com
Tue Nov 28 22:28:13 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/one-time-cc-special-chars has been created
at 57976db4e0350e477627b55d27d6d44fc6e2b005 (commit)
- Log -----------------------------------------------------------------
commit 57976db4e0350e477627b55d27d6d44fc6e2b005
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Nov 28 17:21:29 2023 -0500
Escape one-time checkbox name in case it contains special regex characters
This is to fix emails like foo+bar at example.com, previously its
corresponding checkbox couldn't be checked because of the "+".
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 6446e46042..4601292f63 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -292,7 +292,8 @@ jQuery( function() {
var unchecked = 0;
jQuery('input:checkbox[name^=' + prefix + ']').each( function() {
var name = jQuery(this).attr('name');
- name = name.replace(prefix + '-', '');
+ name = escapeRegExp(name.replace(prefix + '-', ''));
+
var filter_function = function(n,i) {
return n.match(new RegExp('^\\s*' + name + '\\s*$', 'i')) || n.match(new RegExp('<\\s*' + name + '\\s*>', 'i'));
};
diff --git a/share/static/js/util.js b/share/static/js/util.js
index d349bd6dcc..a47f7db242 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -677,6 +677,10 @@ function escapeCssSelector(str) {
return str.replace(/([^A-Za-z0-9_-])/g,'\\$1');
}
+function escapeRegExp(str) {
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
+}
+
function createCookie(name,value,days) {
var path = RT.Config.WebPath ? RT.Config.WebPath : "/";
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list