Browse Source

`yii\console\controllers\AssetController` now correctly handles relative image URLs if source and target CSS are under same directory

tags/2.0.3
Klimov Paul 10 years ago
parent
commit
5bda2fe073
  1. 1
      framework/CHANGELOG.md
  2. 3
      framework/console/controllers/AssetController.php
  3. 6
      tests/unit/framework/console/controllers/AssetControllerTest.php

1
framework/CHANGELOG.md

@ -7,6 +7,7 @@ Yii Framework 2 Change Log
- Bug #6919: Fixed wrong namespaces under advanced application's TestCase classes (ivokund)
- Bug #6940: `yii\web\Response::sendContentAsFile()` may not send correct `content-length` header (sadgnome)
- Bug #6969: `yii\helpers\ArrayHelper::htmlEncode()` and `htmlDecode()` should not remove non-string data (qiangxue)
- Bug #7037: `yii\console\controllers\AssetController` now correctly handles relative image URLs if source and target CSS are under same directory (klimov-paul)
- Enh #5663: Added support for using `data-params` to specify additional form data to be submitted via the `data-method` approach (usualdesigner, qiangxue)
- Enh #6106: Added ability to specify `encode` for each item of `yii\widgets\Breadcrumbs` (samdark, aleksanderd)
- Enh #6493: Added support for the `Access-Control-Expose-Headers` header by `yii\filters\Cors` (usualdesigner)

3
framework/console/controllers/AssetController.php

@ -613,6 +613,9 @@ EOD;
if (strpos($inputUrl, '/') === 0 || preg_match('/^https?:\/\//is', $inputUrl) || preg_match('/^data:/is', $inputUrl)) {
return $fullMatch;
}
if ($inputFileRelativePathParts === $outputFileRelativePathParts) {
return $fullMatch;
}
if (empty($outputFileRelativePathParts)) {
$outputUrlParts = [];

6
tests/unit/framework/console/controllers/AssetControllerTest.php

@ -466,6 +466,12 @@ EOL;
'/test/base/path/assets/output',
'.static-root-relative-class {background-image: url(\'/images/static_root_relative.png\');}',
],
[
'.published-relative-dir-class {background-image: url(../img/same_relative_dir.png);}',
'/test/base/path/assets/css',
'/test/base/path/assets/css',
'.published-relative-dir-class {background-image: url(../img/same_relative_dir.png);}',
],
];
}

Loading…
Cancel
Save