Skip to content

Commit eb1429d

Browse files
committed
Fix service worker for docs with multiple versions
1 parent 1990901 commit eb1429d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

views/service-worker.js.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ 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.includes('.')) {
51+
if (url.origin === location.origin && !url.pathname.replace(/~([0-9.])+/, '').includes('.')) {
5252
const cachedIndex = await caches.match('/');
5353
if (cachedIndex) return cachedIndex;
5454
}

0 commit comments

Comments
 (0)