Browse Source

Added skipping for absolute URLs at "AssetController::adjustCssUrl()".

tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
f65d1398a5
  1. 4
      framework/yii/console/controllers/AssetController.php
  2. 12
      tests/unit/framework/console/controllers/AssetControllerTest.php

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

12
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);}',
),
);
}

Loading…
Cancel
Save