Skip to content

Commit

Permalink
fix(core): ensure non-html files get skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 27, 2023
1 parent 3d6f2c7 commit e2fc345
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/src/puppeteer/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ export async function createUnlighthouseWorker(tasks: Record<UnlighthouseTask, T
}
}

const lastPathSegment = path.split('/').pop() || path
const extension = (lastPathSegment.includes('.') ? lastPathSegment.split('.').pop() : 'html') || 'html'
if (!extension.includes('html')) {
logger.debug('Skipping non-HTML file from scanning', { path })
return
}

/*
* Allow sampling of named routes.
*
Expand Down

0 comments on commit e2fc345

Please sign in to comment.