From a08a03876ff242f3b8595fec2ea6776ad0dbd8f7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 22 Feb 2019 14:54:13 -0800 Subject: [PATCH] (stable) Fix URI construction of typeahead browse "more" pager Summary: Ref T13251. See . Test Plan: - With more than 100 projects (or, set `$limit = 3`)... - Edit a task, then click the "Browse" magnifying glass icon next to the "Tags" typeahead. - Before change: fatal on 'q' being null. - After change: no fatal. Reviewers: amckinley, 20after4 Reviewed By: amckinley Maniphest Tasks: T13251 Differential Revision: https://secure.phabricator.com/D20204 --- ...ricatorTypeaheadModularDatasourceController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php index efc9ea5f65..2d55c5f663 100644 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php @@ -127,10 +127,20 @@ final class PhabricatorTypeaheadModularDatasourceController if (($offset + (2 * $limit)) < $hard_limit) { $next_uri = id(new PhutilURI($request->getRequestURI())) ->replaceQueryParam('offset', $offset + $limit) - ->replaceQueryParam('q', $query) - ->replaceQueryParam('raw', $raw_query) ->replaceQueryParam('format', 'html'); + if ($query !== null) { + $next_uri->replaceQueryParam('q', $query); + } else { + $next_uri->removeQueryParam('q'); + } + + if ($raw_query !== null) { + $next_uri->replaceQueryParam('raw', $raw_query); + } else { + $next_uri->removeQueryParam('raw'); + } + $next_link = javelin_tag( 'a', array(