Skip to content

Commit 9c475ec

Browse files
committed
Merge pull request #301 from eggyal/patch-1
Generate candidates from decoded URLs
2 parents c8a5052 + 278342b commit 9c475ec

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Doctrine/Phpcr/PrefixCandidates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function restrictQuery($queryBuilder)
103103
public function getCandidates(Request $request)
104104
{
105105
$candidates = array();
106-
$url = $request->getPathInfo();
106+
$url = rawurldecode($request->getPathInfo());
107107
foreach ($this->getPrefixes() as $prefix) {
108108
$candidates = array_unique(array_merge($candidates, $this->getCandidatesFor($url, $prefix)));
109109
}

Tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ public function testGetCandidates()
5050
);
5151
}
5252

53+
public function testGetCandidatesPercentEncoded()
54+
{
55+
$request = Request::create('/my/path%20percent%20encoded.html');
56+
57+
$candidates = new PrefixCandidates(array('/routes', '/simple'));
58+
$paths = $candidates->getCandidates($request);
59+
60+
$this->assertEquals(
61+
array(
62+
'/routes/my/path percent encoded.html',
63+
'/routes/my/path percent encoded',
64+
'/routes/my',
65+
'/routes',
66+
'/simple/my/path percent encoded.html',
67+
'/simple/my/path percent encoded',
68+
'/simple/my',
69+
'/simple',
70+
),
71+
$paths
72+
);
73+
}
74+
5375
public function testGetCandidatesLocales()
5476
{
5577
$request = Request::create('/de/path.html');

0 commit comments

Comments
 (0)