Skip to content

Commit

Permalink
fix: ignore regexes in fetchDirConfig (#2362)
Browse files Browse the repository at this point in the history
  • Loading branch information
gierschv committed Oct 9, 2023
1 parent 5248aa6 commit 9ec555e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/query/match/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ export function createPipelineFetcher<T> (getContentsList: () => Promise<T[]>) {
},
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
Expand Down

0 comments on commit 9ec555e

Please sign in to comment.