1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3817 from node-red/fix-regex-name-handle

Allow generateNodeNames to handle names containing regex control chars
This commit is contained in:
Nick O'Leary 2022-08-04 12:58:06 +01:00 committed by GitHub
commit 86ac955b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1015,7 +1015,7 @@ RED.view.tools = (function() {
const nodeDef = n._def || RED.nodes.getType(n.type)
if (nodeDef && nodeDef.defaults && nodeDef.defaults.name) {
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)) {
const existingNodes = RED.nodes.filterNodes({type: n.type})
let maxNameNumber = 0;