[devdocsgjs/main: 732/1867] Fix service worker for docs with multiple versions




commit eb1429da12c93099df4b3a7da5f1e8ec364b4527
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Tue Aug 6 00:03:58 2019 +0200

    Fix service worker for docs with multiple versions

 views/service-worker.js.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/views/service-worker.js.erb b/views/service-worker.js.erb
index b4c77de6..e64e6355 100644
--- a/views/service-worker.js.erb
+++ b/views/service-worker.js.erb
@@ -48,7 +48,7 @@ self.addEventListener('fetch', event => {
 
       <%# 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 %>
       <%# The index page will make sure the correct documentation or a proper offline page is shown  %>
-      if (url.origin === location.origin && !url.pathname.includes('.')) {
+      if (url.origin === location.origin && !url.pathname.replace(/~([0-9.])+/, '').includes('.')) {
         const cachedIndex = await caches.match('/');
         if (cachedIndex) return cachedIndex;
       }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]