Sotaro KARASAWA 10 лет назад
Родитель
Сommit
fa76fd35bc
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      lib/models/updatePost.js
  2. 1 1
      test/models/updatePost.test.js

+ 1 - 0
lib/models/updatePost.js

@@ -51,6 +51,7 @@ module.exports = function(crowi) {
       reg = '/*' + reg + '*';
     }
     reg = '^' + reg;
+    reg = reg.replace(/\//g, '\\/');
     reg = reg.replace(/(\*)/g, '.*');
 
     return new RegExp(reg);

+ 1 - 1
test/models/updatePost.test.js

@@ -28,7 +28,7 @@ describe('UpdatePost', function () {
 
   describe('.getRegExpByPattern', function () {
     context('with a pattern', function() {
-      it('should return true', function(done) {
+      it('should return right regexp', function(done) {
         expect(UpdatePost.getRegExpByPattern('/*')).to.deep.equal(/^\/.*/);
         expect(UpdatePost.getRegExpByPattern('/user/*/日報*')).to.deep.equal(/^\/user\/.*\/日報.*/);
         expect(UpdatePost.getRegExpByPattern('/project/hoge/*')).to.deep.equal(/^\/project\/hoge\/.*/);