Fix broken initial page load by excluding our own JavaScript. Also return 404 on error.

This commit is contained in:
Dan 2017-12-22 23:16:48 -08:00
parent f670087097
commit e6fc8a8b13
1 changed files with 4 additions and 1 deletions

View File

@ -77,7 +77,9 @@ self.addEventListener('fetch', (event) => {
// If this isn't an IPFS URL, bail. // If this isn't an IPFS URL, bail.
if (!multihash.startsWith('/ipfs/')) { if (!multihash.startsWith('/ipfs/')) {
console.log('not a valid IPFS hash:', multihash) console.log('not a valid IPFS hash:', multihash)
event.respondWith(not_found_response()) if (multihash != '/bundle.js' && multihash != '/fetcher.js') {
event.respondWith(not_found_response())
}
return return
} }
@ -115,6 +117,7 @@ self.addEventListener('fetch', (event) => {
return not_found_response() return not_found_response()
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
return not_found_response()
}) })
) )
}) })