mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixing trailing slash in URL when extension is used (Ticket #2934)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5439 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4d4cf07c84
commit
2664ed2ee4
2 changed files with 9 additions and 0 deletions
|
@ -601,6 +601,9 @@ class Router extends Object {
|
|||
if ($full) {
|
||||
$output = FULL_BASE_URL . $output;
|
||||
}
|
||||
if(!empty($extension) && substr($output, -1) == '/') {
|
||||
$output = substr($output, 0, -1);
|
||||
}
|
||||
return $output . $extension . $_this->queryString($q) . $frag;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -158,6 +158,12 @@ class RouterTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testUrlGenerationWithExtensions() {
|
||||
$result = $this->router->url(array('plugin' => null, 'controller' => 'articles', 'action' => 'add', 'id' => null, 'ext' => 'json'));
|
||||
$expected = '/articles/add.json';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testPluginUrlGeneration() {
|
||||
$this->router->setRequestInfo(array(
|
||||
array(
|
||||
|
|
Loading…
Add table
Reference in a new issue