Skip to content

Commit

Permalink
validate there is a content header before proceeding
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Jul 21, 2024
1 parent 6914877 commit 38d1819
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/uv.sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class UVServiceWorker extends Ultraviolet.EventEmitter {
break;
case 'iframe':
case 'document':
if (responseCtx.getHeader("content-type").startsWith("text/html")) {
if (responseCtx.getHeader("content-type") && responseCtx.getHeader("content-type").startsWith("text/html")) {
let modifiedResponse = await response.text();
if (Array.isArray(this.config.inject)) {
const headPosition = modifiedResponse.indexOf('</head>');
Expand Down

0 comments on commit 38d1819

Please sign in to comment.