From 11b0d243ff19c05ba5898081cb791266b5b4e852 Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Mon, 23 Apr 2012 23:43:09 -0500 Subject: [PATCH] Fixes --- laravel/bundle.php | 4 +--- laravel/url.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index f2949d77..32965390 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -297,9 +297,7 @@ public static function assets($bundle) { if (is_null($bundle)) return static::assets(DEFAULT_BUNDLE); - $server = Config::get('application.asset_url', URL::base() ); - - return ($bundle != DEFAULT_BUNDLE) ? $server."/bundles/{$bundle}/" : $server.'/'; + return ($bundle != DEFAULT_BUNDLE) ? "/bundles/{$bundle}/" : '/'; } /** diff --git a/laravel/url.php b/laravel/url.php index ec2de9e5..9c73526e 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -220,6 +220,18 @@ protected static function convention($action, $parameters) */ public static function to_asset($url, $https = null) { + + // If the URL is already well-formed, just return it + if (static::valid($url)) return $url; + + // If a base asset URL is defined in the configuration, use that and + // don't try and change links to http/https. + if ($root = Config::get('application.asset_url', false )) { + + return rtrim($root, '/').'/'.ltrim($url, '/'); + + } + if (is_null($https)) $https = Request::secure(); $url = static::to($url, $https);