Skip to content

Commit 938b460

Browse files
committed
Add trailing slash to service worker scope
This will ensure it always matches or is underneath the allowed service worker scope. Fixes #2076.
1 parent fef619a commit 938b460

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/browser/register.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if ("serviceWorker" in navigator) {
1010
const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`)
1111
navigator.serviceWorker
1212
.register(path, {
13-
scope: options.base || "/",
13+
scope: (options.base ?? "") + "/",
1414
})
1515
.then(() => {
1616
console.log("[Service Worker] registered")

0 commit comments

Comments
 (0)