Răsfoiți Sursa

fix filter/except attributes

Yuki Takei 3 ani în urmă
părinte
comite
a838618531
1 a modificat fișierele cu 4 adăugiri și 3 ștergeri
  1. 4 3
      packages/remark-lsx/src/server/routes/lsx.js

+ 4 - 3
packages/remark-lsx/src/server/routes/lsx.js

@@ -1,6 +1,6 @@
 import createError, { isHttpError } from 'http-errors';
 import createError, { isHttpError } from 'http-errors';
 
 
-const { pagePathUtils, customTagUtils } = require('@growi/core');
+const { pathUtils, pagePathUtils, customTagUtils } = require('@growi/core');
 
 
 const { OptionParser } = customTagUtils;
 const { OptionParser } = customTagUtils;
 
 
@@ -8,6 +8,7 @@ const { OptionParser } = customTagUtils;
 const DEFAULT_PAGES_NUM = 50;
 const DEFAULT_PAGES_NUM = 50;
 
 
 
 
+const { addTrailingSlash } = pathUtils;
 const { isTopPage } = pagePathUtils;
 const { isTopPage } = pagePathUtils;
 
 
 class Lsx {
 class Lsx {
@@ -105,10 +106,10 @@ class Lsx {
     let filterPath = '';
     let filterPath = '';
     if (optionsFilter.charAt(0) === '^') {
     if (optionsFilter.charAt(0) === '^') {
       // move '^' to the first of path
       // move '^' to the first of path
-      filterPath = new RegExp(`^${pagePath}${optionsFilter.slice(1, optionsFilter.length)}`);
+      filterPath = new RegExp(`^${addTrailingSlash(pagePath)}${optionsFilter.slice(1, optionsFilter.length)}`);
     }
     }
     else {
     else {
-      filterPath = new RegExp(`^${pagePath}.*${optionsFilter}`);
+      filterPath = new RegExp(`^${addTrailingSlash(pagePath)}.*${optionsFilter}`);
     }
     }
 
 
     if (isExceptFilter) {
     if (isExceptFilter) {