Skip to content

Commit

Permalink
fix(service-worker): check for asset urls
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Apr 7, 2022
1 parent 42ff5a3 commit aab6fbf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/runtime/entries/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import '#nitro/virtual/polyfill'
import { requestHasBody, useRequestBody } from '../utils'
import { nitroApp } from '../app'
import { isPublicAssetURL } from '#nitro/virtual/public-assets'

addEventListener('fetch', (event: any) => {
const url = new URL(event.request.url)

// TODO: Check for static assets base
if (url.pathname.includes('.') && !url.pathname.startsWith('/api')) {
const pathname = new URL(event.request.url).pathname
if (isPublicAssetURL(pathname) || pathname.includes('/_server/')) {
return
}

Expand Down

0 comments on commit aab6fbf

Please sign in to comment.