From e6fc8a8b1305735bd240a98da63e1fc3803c625f Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 22 Dec 2017 23:16:48 -0800 Subject: [PATCH] Fix broken initial page load by excluding our own JavaScript. Also return 404 on error. --- src/fetcher.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fetcher.js b/src/fetcher.js index d8100a5..b6e2918 100644 --- a/src/fetcher.js +++ b/src/fetcher.js @@ -77,7 +77,9 @@ self.addEventListener('fetch', (event) => { // If this isn't an IPFS URL, bail. if (!multihash.startsWith('/ipfs/')) { 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 } @@ -115,6 +117,7 @@ self.addEventListener('fetch', (event) => { return not_found_response() }).catch((error) => { console.log(error) + return not_found_response() }) ) })