Przeglądaj źródła

use javascript length

reiji-h 1 rok temu
rodzic
commit
d0a80e6a7b

+ 1 - 2
packages/core/src/utils/page-path-utils/index.ts

@@ -117,10 +117,9 @@ const restrictedPatternsToCreate: Array<RegExp> = [
   /^\/(_search|_private-legacy-pages)(\/.*|$)/,
   /^\/(_search|_private-legacy-pages)(\/.*|$)/,
   /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/,
   /^\/(installer|register|login|logout|admin|me|files|trash|paste|comments|tags|share|attachment)(\/.*|$)/,
   /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1
   /^\/user(?:\/[^/]+)?$/, // https://regex101.com/r/9Eh2S1/1
-  /^.{2000000,}$/, // avoid very long path. see: https://regex101.com/r/s9cCdf/1
 ];
 ];
 export const isCreatablePage = (path: string): boolean => {
 export const isCreatablePage = (path: string): boolean => {
-  return !restrictedPatternsToCreate.some(pattern => path.match(pattern));
+  return !restrictedPatternsToCreate.some(pattern => path.match(pattern)) && path.length <= 2_000_000;
 };
 };
 
 
 /**
 /**