diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 1ec6dbb..a26546a 100644 --- a/framework/CHANGELOG.md +++ b/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) diff --git a/framework/console/controllers/AssetController.php b/framework/console/controllers/AssetController.php index 00fc73b..bfca90e 100644 --- a/framework/console/controllers/AssetController.php +++ b/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 = []; diff --git a/tests/unit/framework/console/controllers/AssetControllerTest.php b/tests/unit/framework/console/controllers/AssetControllerTest.php index e69f9d4..ae031b0 100644 --- a/tests/unit/framework/console/controllers/AssetControllerTest.php +++ b/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);}', + ], ]; }