From 938b4606855c48bf36a6bd0c6b8b99c222c7e879 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 9 Sep 2020 12:05:04 -0500 Subject: [PATCH] Add trailing slash to service worker scope This will ensure it always matches or is underneath the allowed service worker scope. Fixes #2076. --- src/browser/register.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/register.ts b/src/browser/register.ts index 60f054bc3..4f8345808 100644 --- a/src/browser/register.ts +++ b/src/browser/register.ts @@ -10,7 +10,7 @@ if ("serviceWorker" in navigator) { const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`) navigator.serviceWorker .register(path, { - scope: options.base || "/", + scope: (options.base ?? "") + "/", }) .then(() => { console.log("[Service Worker] registered")