From b6b753ee4ce5acdca05476fefde2874f3f3813bb Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 14 Feb 2014 09:38:37 +1300 Subject: [PATCH] FIX: Fixed encoding of & in OpenSearchDescription URLs. Without this fix, the & was then passed to urlencode(), which escaped the ; and make invalid XML. This keeps XML out of the source URL (so the & is just a raw & in the code) and relies on the template engine to escape XML as needed (the .XML on the end of the variables). --- code/controllers/DocumentationOpenSearchController.php | 4 ++-- templates/OpenSearchDescription.ss | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/controllers/DocumentationOpenSearchController.php b/code/controllers/DocumentationOpenSearchController.php index bfd350d..d6575c1 100644 --- a/code/controllers/DocumentationOpenSearchController.php +++ b/code/controllers/DocumentationOpenSearchController.php @@ -27,10 +27,10 @@ class DocumentationOpenSearchController extends Controller { $link = Director::absoluteBaseUrl() . $data['SearchPageLink'] = Controller::join_links( $viewer->Link(), - 'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1' + 'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1' ); - $data['SearchPageAtom'] = $data['SearchPageLink'] . '&format=atom'; + $data['SearchPageAtom'] = $data['SearchPageLink'] . '&format=atom'; return $this->customise( new ArrayData($data) diff --git a/templates/OpenSearchDescription.ss b/templates/OpenSearchDescription.ss index c75384e..30ef3b4 100755 --- a/templates/OpenSearchDescription.ss +++ b/templates/OpenSearchDescription.ss @@ -6,7 +6,7 @@ <% if Tags %>$Tags<% end_if %> <% if Contact %>$Content<% end_if %> - <% if SearchPageLink %><% end_if %> - <% if SearchPageAtom %><% end_if %> - <% if SearchPageJson %><% end_if %> + <% if SearchPageLink %><% end_if %> + <% if SearchPageAtom %><% end_if %> + <% if SearchPageJson %><% end_if %> \ No newline at end of file