aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Controller
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-08-11 09:03:21 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-08-17 18:56:37 +0200
commit3344f0f121865e03d4bc076fe79e7d88f32836da (patch)
treef2ee238b127e00779c771e326806c03a62faa4ae /apps/files/lib/Controller
parent410f58e43e8db767eaf0b272ab6ffde1841cd6a2 (diff)
downloadnextcloud-server-3344f0f121865e03d4bc076fe79e7d88f32836da.tar.gz
nextcloud-server-3344f0f121865e03d4bc076fe79e7d88f32836da.zip
fix(files): service worker
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib/Controller')
-rw-r--r--apps/files/lib/Controller/ApiController.php1
-rw-r--r--apps/files/lib/Controller/ViewController.php11
2 files changed, 3 insertions, 9 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index 3d490f06b75..bee6fb26d9e 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -388,6 +388,7 @@ class ApiController extends Controller {
/**
* @NoAdminRequired
* @NoCSRFRequired
+ * @PublicPage
*
* Get the service-worker Javascript for previews
*
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 24f236a0893..e8621c1fa14 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -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);