|
@@ -661,7 +661,7 @@ module.exports = function(crowi) {
|
|
|
var pathCondition = [];
|
|
var pathCondition = [];
|
|
|
var includeDeletedPage = option.includeDeletedPage || false;
|
|
var includeDeletedPage = option.includeDeletedPage || false;
|
|
|
|
|
|
|
|
- var queryReg = new RegExp('^' + path);
|
|
|
|
|
|
|
+ var queryReg = new RegExp('^' + escapeRoundBrackets(path));
|
|
|
pathCondition.push({path: queryReg});
|
|
pathCondition.push({path: queryReg});
|
|
|
if (path.match(/\/$/)) {
|
|
if (path.match(/\/$/)) {
|
|
|
debug('Page list by ending with /, so find also upper level page');
|
|
debug('Page list by ending with /, so find also upper level page');
|
|
@@ -1090,7 +1090,7 @@ module.exports = function(crowi) {
|
|
|
pageSchema.statics.renameRecursively = function(pageData, newPagePathPrefix, user, options) {
|
|
pageSchema.statics.renameRecursively = function(pageData, newPagePathPrefix, user, options) {
|
|
|
var Page = this
|
|
var Page = this
|
|
|
, path = pageData.path
|
|
, path = pageData.path
|
|
|
- , pathRegExp = new RegExp('^' + path, 'i');
|
|
|
|
|
|
|
+ , pathRegExp = new RegExp('^' + escapeRoundBrackets(path), 'i');
|
|
|
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
return new Promise(function(resolve, reject) {
|
|
|
Page
|
|
Page
|
|
@@ -1113,6 +1113,13 @@ module.exports = function(crowi) {
|
|
|
return;
|
|
return;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ function escapeRoundBrackets(path) {
|
|
|
|
|
+ // replace
|
|
|
|
|
+ // '(' -> '\('
|
|
|
|
|
+ // ')' -> '\)'
|
|
|
|
|
+ return path.replace(/(\(|\))/g, '\\$1');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
pageSchema.statics.GRANT_PUBLIC = GRANT_PUBLIC;
|
|
pageSchema.statics.GRANT_PUBLIC = GRANT_PUBLIC;
|
|
|
pageSchema.statics.GRANT_RESTRICTED = GRANT_RESTRICTED;
|
|
pageSchema.statics.GRANT_RESTRICTED = GRANT_RESTRICTED;
|
|
|
pageSchema.statics.GRANT_SPECIFIED = GRANT_SPECIFIED;
|
|
pageSchema.statics.GRANT_SPECIFIED = GRANT_SPECIFIED;
|