]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): service worker
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 11 Aug 2023 07:03:21 +0000 (09:03 +0200)
committerJohn Molakvoæ <skjnldsv@protonmail.com>
Thu, 17 Aug 2023 16:56:37 +0000 (18:56 +0200)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/files/lib/Controller/ApiController.php
apps/files/lib/Controller/ViewController.php

index 3d490f06b75b2895c24a710e07c397acf22416cc..bee6fb26d9e8daf0e3f631a2399e4ef9a3e3bc58 100644 (file)
@@ -388,6 +388,7 @@ class ApiController extends Controller {
        /**
         * @NoAdminRequired
         * @NoCSRFRequired
+        * @PublicPage
         *
         * Get the service-worker Javascript for previews
         *
index 24f236a0893953bcbf5c1f6eba753d601563f1db..e8621c1fa14e27443a94cd8c58e01767d6a93a5b 100644 (file)
@@ -178,15 +178,6 @@ class ViewController extends Controller {
         * @throws NotFoundException
         */
        public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false, $openfile = null) {
-
-               if ($fileid !== null && $dir === '') {
-                       try {
-                               return $this->redirectToFile($fileid);
-                       } catch (NotFoundException $e) {
-                               return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
-                       }
-               }
-
                // Load the files we need
                \OCP\Util::addStyle('files', 'merged');
                \OCP\Util::addScript('files', 'merged-index', 'files');
@@ -242,6 +233,8 @@ class ViewController extends Controller {
                );
                $policy = new ContentSecurityPolicy();
                $policy->addAllowedFrameDomain('\'self\'');
+               // Allow preview service worker
+               $policy->addAllowedWorkerSrcDomain('\'self\'');
                $response->setContentSecurityPolicy($policy);
 
                $this->provideInitialState($dir, $openfile);