Commit dd39df9d authored by catch's avatar catch

Issue #2087243 by olli: Fixed Views block category is double escaped with autocomplete.

parent 24f3e119
......@@ -59,8 +59,7 @@ public function autocomplete(Request $request) {
$matches = array();
foreach ($this->blockManager->getCategories() as $category) {
if (stripos($category, $typed_category) === 0) {
$category = String::checkPlain($category);
$matches[$category] = $category;
$matches[$category] = String::checkPlain($category);
}
}
return new JsonResponse($matches);
......
......@@ -63,9 +63,9 @@ public function setUp() {
public function testAutocompleteSuggestions($string, $suggestions) {
$suggestions = array_map(function ($suggestion) {
return String::checkPlain($suggestion);
}, $suggestions);
}, MapArray::copyValuesToKeys($suggestions));
$result = $this->autocompleteController->autocomplete(new Request(array('q' => $string)));
$this->assertSame(MapArray::copyValuesToKeys($suggestions), json_decode($result->getContent(), TRUE));
$this->assertSame($suggestions, json_decode($result->getContent(), TRUE));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment