fix spaces in searches and filters #7717
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Mar 26, 2026 at 18:01 UTC
90e5fcb1929f9328460b607ffa0c490f661cadd3
4 files changed
+4
-4
meshctrl.js
+1
-1
@@ -2706,7 +2706,7 @@ function getDevicesThatMatchFilter(nodes, x) {
2706
} else {
2707
// Device name search
2708
try {
2709
- var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2709
+ var rs = x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
2710
for (var d in nodes) {
2711
//if (showRealNames) {
2712
//if (nodes[d].rnamel != null && rx.test(nodes[d].rnamel.toLowerCase())) { r.push(nodes[d]); }
views/default-mobile.handlebars
+1
-1
@@ -3174,7 +3174,7 @@
3174
} else {
3175
// Device name search
3176
try {
3177
- var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
3177
+ var rs = x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
3178
for (var d in nodes) {
3179
if (features2 & 0x00008000) {
3180
if(features2 & 0x10000000){
views/default.handlebars
+1
-1
@@ -6502,7 +6502,7 @@
6502
} else {
6503
// Device name search
6504
try {
6505
- var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
6505
+ var rs = x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
6506
for (var d in nodes) {
6507
if (features2 & 0x00008000) { // Both server and client names must match
6508
if(features2 & 0x10000000){
views/default3.handlebars
+1
-1
@@ -7396,7 +7396,7 @@
7396
} else {
7397
// Device name search
7398
try {
7399
- var rs = x.split(/\s+/).join('|'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
7399
+ var rs = x.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), rx = new RegExp(rs); // In some cases (like +), this can throw an exception.
7400
for (var d in nodes) {
7401
if (features2 & 0x00008000) { // Both server and client names must match
7402
if (features2 & 0x10000000) {