From a7bd8d42e8f1a35faee9f08146eec50e0730f7dd Mon Sep 17 00:00:00 2001 From: "John R. Supplee" Date: Sat, 23 Jan 2021 12:06:37 +0200 Subject: [PATCH] Boards.copyTitle - escape string used in regex --- models/boards.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/boards.js b/models/boards.js index 38594ca51..35b00ee75 100644 --- a/models/boards.js +++ b/models/boards.js @@ -569,7 +569,7 @@ Boards.helpers({ */ copyTitle() { const m = this.title.match(/^(?.*?)\s*(\[(?<num>\d+)]\s*$|\s*$)/); - const title = m.groups.title; + const title = escapeForRegex(m.groups.title); let num = 0; Boards.find({ title: new RegExp(`^${title}\\s*\\[\\d+]\\s*$`) }).forEach( board => {