From 839ee5eac18b00ae9a66ea6ba47507a6a91bb337 Mon Sep 17 00:00:00 2001 From: oparoz Date: Mon, 11 Jul 2016 14:08:25 +0200 Subject: [PATCH 1/2] Make theming work with pretty URLs In some envs the rewrite rules for pretty URLs apply to all CSS files, so let's not end the route name with that etension. Fixes #315 --- apps/theming/appinfo/routes.php | 2 +- apps/theming/lib/controller/themingcontroller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/theming/appinfo/routes.php b/apps/theming/appinfo/routes.php index ac0463e2c26a2..dcbb0618fa218 100644 --- a/apps/theming/appinfo/routes.php +++ b/apps/theming/appinfo/routes.php @@ -40,7 +40,7 @@ ], [ 'name' => 'Theming#getStylesheet', - 'url' => '/styles.css', + 'url' => '/styles', 'verb' => 'GET', ], [ diff --git a/apps/theming/lib/controller/themingcontroller.php b/apps/theming/lib/controller/themingcontroller.php index 995f929b510c7..a9ac36ca78670 100644 --- a/apps/theming/lib/controller/themingcontroller.php +++ b/apps/theming/lib/controller/themingcontroller.php @@ -234,7 +234,7 @@ public function getStylesheet() { \OC_Response::setExpiresHeader(gmdate('D, d M Y H:i:s', time() + (60*60*24*45)) . ' GMT'); \OC_Response::enableCaching(); - $response = new Http\DataDownloadResponse($responseCss, 'style.css', 'text/css'); + $response = new Http\DataDownloadResponse($responseCss, 'style', 'text/css'); $response->cacheFor(3600); return $response; } From eceb0db4d2f7a952d19c61d877426060f09cb2e2 Mon Sep 17 00:00:00 2001 From: oparoz Date: Mon, 11 Jul 2016 14:23:43 +0200 Subject: [PATCH 2/2] Fix tests --- .../tests/lib/controller/ThemingControllerTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/theming/tests/lib/controller/ThemingControllerTest.php b/apps/theming/tests/lib/controller/ThemingControllerTest.php index 7fba27316a227..d08ebce86634d 100644 --- a/apps/theming/tests/lib/controller/ThemingControllerTest.php +++ b/apps/theming/tests/lib/controller/ThemingControllerTest.php @@ -323,7 +323,7 @@ public function testGetStylesheetWithOnlyColor() { ->with('theming', 'backgroundMime', '') ->willReturn(''); - $expected = new Http\DataDownloadResponse('#body-user #header,#body-settings #header,#body-public #header {background-color: #fff}', 'style.css', 'text/css'); + $expected = new Http\DataDownloadResponse('#body-user #header,#body-settings #header,#body-public #header {background-color: #fff}', 'style', 'text/css'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getStylesheet()); } @@ -356,7 +356,7 @@ public function testGetStylesheetWithOnlyHeaderLogo() { #header .logo-icon { background-image: url(\'./logo?v=0\'); background-size: 62px 34px; - }', 'style.css', 'text/css'); + }', 'style', 'text/css'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getStylesheet()); } @@ -385,7 +385,7 @@ public function testGetStylesheetWithOnlyBackgroundLogin() { $expected = new Http\DataDownloadResponse('#body-login { background-image: url(\'./loginbackground?v=0\'); - }', 'style.css', 'text/css'); + }', 'style', 'text/css'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getStylesheet()); } @@ -420,7 +420,7 @@ public function testGetStylesheetWithAllCombined() { background-size: 62px 34px; }#body-login { background-image: url(\'./loginbackground?v=0\'); - }', 'style.css', 'text/css'); + }', 'style', 'text/css'); $expected->cacheFor(3600); @$this->assertEquals($expected, $this->themingController->getStylesheet()); }