Add trailing slash to service worker scope

This will ensure it always matches or is underneath the allowed service
worker scope.

Fixes #2076.
This commit is contained in:
Asher 2020-09-09 12:05:04 -05:00
parent fef619aef8
commit 938b460685
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 1 additions and 1 deletions

View File

@ -10,7 +10,7 @@ if ("serviceWorker" in navigator) {
const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`) const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`)
navigator.serviceWorker navigator.serviceWorker
.register(path, { .register(path, {
scope: options.base || "/", scope: (options.base ?? "") + "/",
}) })
.then(() => { .then(() => {
console.log("[Service Worker] registered") console.log("[Service Worker] registered")