]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow access to CSS resources 2985/head
authorLukas Reschke <lukas@statuscode.ch>
Mon, 9 Jan 2017 11:52:43 +0000 (12:52 +0100)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 9 Jan 2017 11:53:58 +0000 (12:53 +0100)
Fixes https://github.com/nextcloud/server/issues/2984

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
lib/base.php

index 4a9158eff64bd75bb1d69fd0cc691c694f5ea5b7..0fc34b3d9b9fba8ed662e19831fa6a1fe8fceca9 100644 (file)
@@ -791,23 +791,31 @@ class OC {
                        && !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host)
                        && self::$server->getConfig()->getSystemValue('installed', false)
                ) {
-                       header('HTTP/1.1 400 Bad Request');
-                       header('Status: 400 Bad Request');
+                       // Allow access to CSS resources
+                       $isScssRequest = false;
+                       if(strpos($request->getPathInfo(), '/css/') === 0) {
+                               $isScssRequest = true;
+                       }
+
+                       if (!$isScssRequest) {
+                               header('HTTP/1.1 400 Bad Request');
+                               header('Status: 400 Bad Request');
 
-                       \OC::$server->getLogger()->warning(
+                               \OC::$server->getLogger()->warning(
                                        'Trusted domain error. "{remoteAddress}" tried to access using "{host}" as host.',
                                        [
                                                'app' => 'core',
                                                'remoteAddress' => $request->getRemoteAddress(),
                                                'host' => $host,
                                        ]
-                       );
+                               );
 
-                       $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
-                       $tmpl->assign('domain', $host);
-                       $tmpl->printPage();
+                               $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
+                               $tmpl->assign('domain', $host);
+                               $tmpl->printPage();
 
-                       exit();
+                               exit();
+                       }
                }
                \OC::$server->getEventLogger()->end('boot');
        }