Skip to content

Commit 9ec555e

Browse files
authored
fix: ignore regexes in fetchDirConfig (#2362)
1 parent 5248aa6 commit 9ec555e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/runtime/query/match/pipeline.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ export function createPipelineFetcher<T> (getContentsList: () => Promise<T[]>) {
7474
},
7575
function fetchDirConfig (state, params, db) {
7676
if (params.dirConfig) {
77-
const path = (state.result[0] as any)?._path || params.where?.find(w => w._path)?._path as string
78-
const dirConfig = db.find((item: any) => item._path === joinURL(path, '_dir'))
79-
if (dirConfig) {
80-
// @ts-ignore
81-
state.dirConfig = { _path: dirConfig._path, ...withoutKeys(['_'])(dirConfig) }
77+
const path = (state.result[0] as any)?._path || params.where?.find(w => w._path)?._path as (string | RegExp)
78+
if (typeof path === 'string') {
79+
const dirConfig = db.find((item: any) => item._path === joinURL(path, '_dir'))
80+
if (dirConfig) {
81+
// @ts-ignore
82+
state.dirConfig = { _path: dirConfig._path, ...withoutKeys(['_'])(dirConfig) }
83+
}
8284
}
8385
}
8486
return state

0 commit comments

Comments
 (0)