From f65d1398a55094578f8dadfdfe4ce46c2ccfdb22 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sun, 26 May 2013 21:05:53 +0300 Subject: [PATCH] Added skipping for absolute URLs at "AssetController::adjustCssUrl()". --- framework/yii/console/controllers/AssetController.php | 4 ++++ .../framework/console/controllers/AssetControllerTest.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/framework/yii/console/controllers/AssetController.php b/framework/yii/console/controllers/AssetController.php index 98c67a5..8e3de29 100644 --- a/framework/yii/console/controllers/AssetController.php +++ b/framework/yii/console/controllers/AssetController.php @@ -558,6 +558,10 @@ EOD $fullMatch = $matches[0]; $inputUrl = $matches[1]; + if (preg_match('/https?:\/\//is', $inputUrl)) { + return $fullMatch; + } + $outputUrlParts = array_fill(0, count($outputFileRelativePathParts), '..'); $outputUrlParts = array_merge($outputUrlParts, $inputFileRelativePathParts); diff --git a/tests/unit/framework/console/controllers/AssetControllerTest.php b/tests/unit/framework/console/controllers/AssetControllerTest.php index a76a942..db6d2a7 100644 --- a/tests/unit/framework/console/controllers/AssetControllerTest.php +++ b/tests/unit/framework/console/controllers/AssetControllerTest.php @@ -286,6 +286,18 @@ class AssetControllerTest extends TestCase '/test/base/path/assets/output', '.static-relative-dir-class {background-image: url("../../img/static_relative_dir.png");}', ), + array( + '.absolute-url-class {background-image: url(http://domain.com/img/image.gif);}', + '/test/base/path/assets/input', + '/test/base/path/assets/output', + '.absolute-url-class {background-image: url(http://domain.com/img/image.gif);}', + ), + array( + '.absolute-url-secure-class {background-image: url(https://secure.domain.com/img/image.gif);}', + '/test/base/path/assets/input', + '/test/base/path/assets/output', + '.absolute-url-secure-class {background-image: url(https://secure.domain.com/img/image.gif);}', + ), ); }