Commit f5c5c2fd by Klimov Paul

Fixed `yii\console\controllers\AssetController` breaks CSS URLs in case target…

Fixed `yii\console\controllers\AssetController` breaks CSS URLs in case target file localed at `yii\web\AssetManager::basePath` root
parent 2cdb4674
......@@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #4881: Fixed `yii\console\controllers\AssetController` breaks CSS URLs on Windows (klimov-paul)
- Bug #5171: Fixed the bug that ActiveForm + Pjax submit event is only triggered once (qiangxue)
- Bug #5242: Fixed `yii\console\controllers\AssetController` breaks CSS URLs in case target file localed at `yii\web\AssetManager::basePath` root (klimov-paul)
- Bug #5252: Null values are not properly handled by `RangeValidator` (githubjeka, qiangxue)
- Bug #5260: `yii\i18n\Formatter::decimalSeparator` and `yii\i18n\Formatter::thousandSeparator` where not configurable when intl is not installed (execut, cebe)
- Bug #5314: Fixed typo in the implementation of `yii\web\Session::getHasSessionId()` (qiangxue)
......
......@@ -549,8 +549,16 @@ EOD;
$inputFileRelativePath = trim(str_replace($sharedPath, '', $inputFilePath), '/');
$outputFileRelativePath = trim(str_replace($sharedPath, '', $outputFilePath), '/');
$inputFileRelativePathParts = explode('/', $inputFileRelativePath);
$outputFileRelativePathParts = explode('/', $outputFileRelativePath);
if (empty($inputFileRelativePath)) {
$inputFileRelativePathParts = [];
} else {
$inputFileRelativePathParts = explode('/', $inputFileRelativePath);
}
if (empty($outputFileRelativePath)) {
$outputFileRelativePathParts = [];
} else {
$outputFileRelativePathParts = explode('/', $outputFileRelativePath);
}
$callback = function ($matches) use ($inputFileRelativePathParts, $outputFileRelativePathParts) {
$fullMatch = $matches[0];
......@@ -560,7 +568,11 @@ EOD;
return $fullMatch;
}
$outputUrlParts = array_fill(0, count($outputFileRelativePathParts), '..');
if (empty($outputFileRelativePathParts)) {
$outputUrlParts = [];
} else {
$outputUrlParts = array_fill(0, count($outputFileRelativePathParts), '..');
}
$outputUrlParts = array_merge($outputUrlParts, $inputFileRelativePathParts);
if (strpos($inputUrl, '/') !== false) {
......
......@@ -360,6 +360,18 @@ EOL;
],
[
"@font-face {
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype');
}",
'/test/base/path/assets/input/css',
'/test/base/path/assets',
"@font-face {
src: url('input/fonts/glyphicons-halflings-regular.eot');
src: url('input/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype');
}",
],
[
"@font-face {
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT==) format('truetype');
}",
'/test/base/path/assets/input/css',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment