|
@@ -1,4 +1,4 @@
|
|
|
-import { pagePathUtils } from '@growi/core';
|
|
|
|
|
|
|
+import { pagePathUtils, pathUtils } from '@growi/core';
|
|
|
import mongoose, { ObjectId, QueryCursor } from 'mongoose';
|
|
import mongoose, { ObjectId, QueryCursor } from 'mongoose';
|
|
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
|
import streamToPromise from 'stream-to-promise';
|
|
import streamToPromise from 'stream-to-promise';
|
|
@@ -32,6 +32,8 @@ const {
|
|
|
collectAncestorPaths, isMovablePage,
|
|
collectAncestorPaths, isMovablePage,
|
|
|
} = pagePathUtils;
|
|
} = pagePathUtils;
|
|
|
|
|
|
|
|
|
|
+const { addTrailingSlash } = pathUtils;
|
|
|
|
|
+
|
|
|
const BULK_REINDEX_SIZE = 100;
|
|
const BULK_REINDEX_SIZE = 100;
|
|
|
const LIMIT_FOR_MULTIPLE_PAGE_OP = 20;
|
|
const LIMIT_FOR_MULTIPLE_PAGE_OP = 20;
|
|
|
|
|
|
|
@@ -2365,7 +2367,7 @@ class PageService {
|
|
|
|
|
|
|
|
async normalizeParentRecursively(paths: string[], publicOnly = false): Promise<void> {
|
|
async normalizeParentRecursively(paths: string[], publicOnly = false): Promise<void> {
|
|
|
const ancestorPaths = paths.flatMap(p => collectAncestorPaths(p));
|
|
const ancestorPaths = paths.flatMap(p => collectAncestorPaths(p));
|
|
|
- const regexps = paths.map(p => new RegExp(`^${escapeStringRegexp(p)}`, 'i'));
|
|
|
|
|
|
|
+ const regexps = paths.map(p => new RegExp(`^${escapeStringRegexp(addTrailingSlash(p))}`, 'i'));
|
|
|
|
|
|
|
|
return this._normalizeParentRecursively(regexps, ancestorPaths, publicOnly);
|
|
return this._normalizeParentRecursively(regexps, ancestorPaths, publicOnly);
|
|
|
}
|
|
}
|