Updated cahce bust in post

This commit is contained in:
Marcus Noble 2017-10-15 08:36:26 +01:00
parent 4dbb6e9f26
commit d75dbf1f29
1 changed files with 1 additions and 2 deletions

View File

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