Skip to content

Commit

Permalink
fix(hooks): generate missing dirname & extension in vFile
Browse files Browse the repository at this point in the history
resolves #2970
  • Loading branch information
farnabaz committed Jan 14, 2025
1 parent 164ffb0 commit e048a55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ export async function createParser(collection: ResolvedCollection, nuxt?: Nuxt)
}

return async function parse(file: ContentFile) {
if (file.path && !file.dirname) {
file.dirname = dirname(file.path)
if (file.path) {
file.dirname = file.dirname ?? dirname(file.path)
file.extension = file.extension ?? file.path.split('.').pop()
}
const beforeParseCtx: FileBeforeParseHook = { file, collection, parserOptions }
// @ts-expect-error runtime type
Expand Down

0 comments on commit e048a55

Please sign in to comment.