mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow generateNodeNames to handle names containing regex control characters
Fixes #3813
This commit is contained in:
parent
dc7fef6395
commit
d8e350d603
@ -1015,7 +1015,7 @@ RED.view.tools = (function() {
|
|||||||
const nodeDef = n._def || RED.nodes.getType(n.type)
|
const nodeDef = n._def || RED.nodes.getType(n.type)
|
||||||
if (nodeDef && nodeDef.defaults && nodeDef.defaults.name) {
|
if (nodeDef && nodeDef.defaults && nodeDef.defaults.name) {
|
||||||
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
|
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
|
||||||
const defaultNodeNameRE = new RegExp('^'+paletteLabel+' (\\d+)$')
|
const defaultNodeNameRE = new RegExp('^'+paletteLabel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+' (\\d+)$')
|
||||||
if (!typeIndex.hasOwnProperty(n.type)) {
|
if (!typeIndex.hasOwnProperty(n.type)) {
|
||||||
const existingNodes = RED.nodes.filterNodes({type: n.type})
|
const existingNodes = RED.nodes.filterNodes({type: n.type})
|
||||||
let maxNameNumber = 0;
|
let maxNameNumber = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user