File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,10 @@ self.addEventListener('fetch', event => {
4848
4949 < % # Attempt to return the index page from the cache if the user is visiting a url like devdocs . io / offline or devdocs . io / javascript / global_objects / array / find % >
5050 < % # The index page will make sure the correct documentation or a proper offline page is shown % >
51- if (url.origin === location.origin && ! url . pathname . replace ( / ~ ( [ 0 - 9 . ] ) + / , '' ) . includes ( '.' ) ) {
51+ const pathname = url.pathname;
52+ const filename = pathname.substr(1 + pathname.lastIndexOf('/')).split(/\#|\?/g)[0];
53+
54+ if (url.origin === location.origin && ! filename . includes ( '.' ) ) {
5255 const cachedIndex = await caches . match ( '/' ) ;
5356 if ( cachedIndex ) return cachedIndex ;
5457 }
You can’t perform that action at this time.
0 commit comments