diff --git a/lib/Controller/OtherController.php b/lib/Controller/OtherController.php index 8e7d40d4d..b1a04bc95 100644 --- a/lib/Controller/OtherController.php +++ b/lib/Controller/OtherController.php @@ -166,6 +166,11 @@ public function static(string $name): Http\Response return Util::guardEx(static function () use ($name) { switch ($name) { case 'service-worker.js': + // Disable service worker if server is in debug mode + if (\OC::$server->get(\OCP\IConfig::class)->getSystemValue('debug', false)) { + throw Exceptions::NotFound('Service worker is disabled in debug mode'); + } + $response = (new StreamResponse(__DIR__.'/../../js/memories-service-worker.js'))->setHeaders([ 'Content-Type' => 'application/javascript', 'Service-Worker-Allowed' => '/',