Skip to content

Commit

Permalink
fix(core): always skip paths with non html content-types
Browse files Browse the repository at this point in the history
Fixes #96
  • Loading branch information
harlan-zw committed May 13, 2023
1 parent 790d856 commit 2c753b6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/core/src/puppeteer/tasks/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ export const extractHtmlPayload: (page: Page, route: string) => Promise<{ succes
return { success: false, message: `Invalid response from URL ${route} code: ${response?.status || '404'}.` }

// ignore non-html
if (response.headers['content-type'] && !response.headers['content-type'].includes('text/html')) {
if (!valid || !response)
return { success: false, message: `Invalid response from URL ${route} content type: ${response.headers['content-type']}.` }
}
if (response.headers['content-type'] && !response.headers['content-type'].includes('text/html'))
return { success: false, message: `Non-HTML Content-Type header: ${response.headers['content-type']}.` }

return {
success: true,
Expand Down

0 comments on commit 2c753b6

Please sign in to comment.