Merge pull request #3473 from jrsupplee/patch-2

Boards.copyTitle - escape string used in regex
This commit is contained in:
Lauri Ojansivu 2021-01-23 16:31:21 +02:00 committed by GitHub
commit 3799839539
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -569,7 +569,7 @@ Boards.helpers({
*/
copyTitle() {
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;
Boards.find({ title: new RegExp(`^${title}\\s*\\[\\d+]\\s*$`) }).forEach(
board => {