fix(files): service worker

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
pull/39808/head
John Molakvoæ 3 years ago
parent 410f58e43e
commit 3344f0f121
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
  1. 1
      apps/files/lib/Controller/ApiController.php
  2. 11
      apps/files/lib/Controller/ViewController.php

@ -388,6 +388,7 @@ class ApiController extends Controller {
/**
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
*
* Get the service-worker Javascript for previews
*

@ -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);

Loading…
Cancel
Save