From a0f9a6d701a52017130e47ebe9f5b74ea0f55c44 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 31 Mar 2014 23:17:39 -0400 Subject: [PATCH] Fixes #2937 --- framework/web/View.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/framework/web/View.php b/framework/web/View.php index eb03352..bb0febf 100644 --- a/framework/web/View.php +++ b/framework/web/View.php @@ -10,6 +10,7 @@ namespace yii\web; use Yii; use yii\helpers\Html; use yii\base\InvalidConfigException; +use yii\helpers\Url; /** * View represents a view object in the MVC pattern. @@ -371,7 +372,7 @@ class View extends \yii\base\View } else { $am = Yii::$app->getAssetManager(); $am->bundles[$key] = new AssetBundle([ - 'css' => [$url], + 'css' => [Url::to($url)], 'cssOptions' => $options, 'depends' => (array) $depends, ]); @@ -432,11 +433,8 @@ class View extends \yii\base\View $this->jsFiles[$position][$key] = Html::jsFile($url, $options); } else { $am = Yii::$app->getAssetManager(); - if (strpos($url, '/') !== 0 && strpos($url, '://') === false) { - $url = Yii::$app->getRequest()->getBaseUrl() . '/' . $url; - } $am->bundles[$key] = new AssetBundle([ - 'js' => [$url], + 'js' => [Url::to($url)], 'jsOptions' => $options, 'depends' => (array) $depends, ]);