From 9ec555e41649bb470cfcecec1a440e4082eacc6d Mon Sep 17 00:00:00 2001 From: Vincent Giersch Date: Mon, 9 Oct 2023 14:31:57 +0200 Subject: [PATCH] fix: ignore regexes in fetchDirConfig (#2362) --- src/runtime/query/match/pipeline.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/runtime/query/match/pipeline.ts b/src/runtime/query/match/pipeline.ts index 23e230a3c..81b37d6db 100644 --- a/src/runtime/query/match/pipeline.ts +++ b/src/runtime/query/match/pipeline.ts @@ -74,11 +74,13 @@ export function createPipelineFetcher (getContentsList: () => Promise) { }, function fetchDirConfig (state, params, db) { if (params.dirConfig) { - const path = (state.result[0] as any)?._path || params.where?.find(w => w._path)?._path as string - const dirConfig = db.find((item: any) => item._path === joinURL(path, '_dir')) - if (dirConfig) { - // @ts-ignore - state.dirConfig = { _path: dirConfig._path, ...withoutKeys(['_'])(dirConfig) } + const path = (state.result[0] as any)?._path || params.where?.find(w => w._path)?._path as (string | RegExp) + if (typeof path === 'string') { + const dirConfig = db.find((item: any) => item._path === joinURL(path, '_dir')) + if (dirConfig) { + // @ts-ignore + state.dirConfig = { _path: dirConfig._path, ...withoutKeys(['_'])(dirConfig) } + } } } return state