فهرست منبع

Merge pull request #9699 from weseek/fix/162617-code-ql-error

fix: CodeQL error
Yuki Takei 1 سال پیش
والد
کامیت
1fc12dd169
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      apps/app/src/features/openai/server/routes/middlewares/upsert-ai-assistant-validator.ts

+ 3 - 3
apps/app/src/features/openai/server/routes/middlewares/upsert-ai-assistant-validator.ts

@@ -1,5 +1,6 @@
 import { GroupType } from '@growi/core';
 import { GroupType } from '@growi/core';
 import { isGlobPatternPath, isCreatablePage } from '@growi/core/dist/utils/page-path-utils';
 import { isGlobPatternPath, isCreatablePage } from '@growi/core/dist/utils/page-path-utils';
+import escapeStringRegexp from 'escape-string-regexp';
 import { type ValidationChain, body } from 'express-validator';
 import { type ValidationChain, body } from 'express-validator';
 
 
 import { AiAssistantShareScope, AiAssistantAccessScope } from '../../../interfaces/ai-assistant';
 import { AiAssistantShareScope, AiAssistantAccessScope } from '../../../interfaces/ai-assistant';
@@ -38,10 +39,9 @@ export const upsertAiAssistantValidator: ValidationChain[] = [
     .notEmpty()
     .notEmpty()
     .withMessage('pagePathPatterns must not be empty')
     .withMessage('pagePathPatterns must not be empty')
     .custom((value: string) => {
     .custom((value: string) => {
-
-      // check if the value is a grob pattern path
+      // check if the value is a glob pattern path
       if (value.includes('*')) {
       if (value.includes('*')) {
-        return isGlobPatternPath(value) && isCreatablePage(value.replace('*', ''));
+        return isGlobPatternPath(value) && isCreatablePage(value.replaceAll('*', ''));
       }
       }
 
 
       return isCreatablePage(value);
       return isCreatablePage(value);