Corrects handling of fully-qualified URLs in Router::normalize(), fixes #4036

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7363 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-07-25 11:45:00 +00:00
parent 6add903d84
commit 4451c02b1c
2 changed files with 11 additions and 0 deletions

View file

@ -1151,6 +1151,8 @@ class Router extends Object {
function normalize($url = '/') {
if (is_array($url)) {
$url = Router::url($url);
} elseif (preg_match('/^[a-z\-]+:\/\//', $url)) {
return $url;
}
$paths = Router::getPaths();

View file

@ -246,6 +246,15 @@ class RouterTest extends CakeTestCase {
$result = Router::normalize('/');
$this->assertEqual($result, '/');
$result = Router::normalize('http://google.com/');
$this->assertEqual($result, 'http://google.com/');
$result = Router::normalize('http://google.com//');
$this->assertEqual($result, 'http://google.com//');
$result = Router::normalize('/users/login/scope://foo');
$this->assertEqual($result, '/users/login/scope:/foo');
}
/**
* testUrlGeneration method