Updated cahce bust in post

This commit is contained in:
Marcus Noble 2017-10-15 08:36:26 +01:00
parent 4dbb6e9f26
commit d75dbf1f29

View File

@ -52,8 +52,7 @@ self.addEventListener('fetch', function(event) {
function cacheBust(request) { function cacheBust(request) {
var url = request.url; var url = request.url;
if (url.indexOf(self.location.origin) >= 0) { if (url.indexOf(self.location.origin) >= 0) {
if (url.indexOf('.') < 0 && url[url.length - 1] !== '/') { if (url[url.length - 1] !== '/' && (url.indexOf('.') < 0 || url.lastIndexOf('.') < self.location.origin.length)) {
// When dealing with directories make sure we append a trailing slash
url += `/`; url += `/`;
} }
return `${url}?${Math.random()}`; return `${url}?${Math.random()}`;