Skip to content

Commit

Permalink
fix: filter draft files in production (#2648)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Jun 7, 2024
1 parent ac66984 commit 1787d8b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/server/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ export function serverQueryContent<T = ParsedContent> (event: H3Event, query?: s
params.sort = [{ _file: 1, $numeric: true }]
}

if (!import.meta.dev) {
params.where = params.where || []
if (!params.where.find(item => typeof item._draft !== 'undefined')) {
params.where.push({ _draft: { $ne: true } })
}
}

// Filter by locale if:
// - locales are defined
// - query doesn't already have a locale filter
Expand Down

0 comments on commit 1787d8b

Please sign in to comment.