Boards.copyTitle - escape string used in regex

This commit is contained in:
John R. Supplee 2021-01-23 12:06:37 +02:00
parent 550f7201bb
commit a7bd8d42e8

View file

@ -569,7 +569,7 @@ Boards.helpers({
*/ */
copyTitle() { copyTitle() {
const m = this.title.match(/^(?<title>.*?)\s*(\[(?<num>\d+)]\s*$|\s*$)/); const m = this.title.match(/^(?<title>.*?)\s*(\[(?<num>\d+)]\s*$|\s*$)/);
const title = m.groups.title; const title = escapeForRegex(m.groups.title);
let num = 0; let num = 0;
Boards.find({ title: new RegExp(`^${title}\\s*\\[\\d+]\\s*$`) }).forEach( Boards.find({ title: new RegExp(`^${title}\\s*\\[\\d+]\\s*$`) }).forEach(
board => { board => {