浏览代码

Boards.copyTitle - escape string used in regex

John R. Supplee 4 年之前
父节点
当前提交
a7bd8d42e8
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      models/boards.js

+ 1 - 1
models/boards.js

@@ -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 => {