From 5daf08048be0e0812d6e399082710ba4620d0d0c Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 16 Jul 2012 12:44:14 -0700 Subject: [PATCH] Fix path autocomplete Summary: Paths autocompleter sometimes omits `/`. Test Plan: # Go to https://secure.phabricator.com/owners/new/. # Write `/specs/h` to path. # Delete the second slash resulting in `/specsh`. # Don't find `/specshistorytest.html` in autocomplete. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D2981 --- .../controller/DiffusionPathCompleteController.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionPathCompleteController.php b/src/applications/diffusion/controller/DiffusionPathCompleteController.php index 69ed227b71..67108c72b3 100644 --- a/src/applications/diffusion/controller/DiffusionPathCompleteController.php +++ b/src/applications/diffusion/controller/DiffusionPathCompleteController.php @@ -34,15 +34,12 @@ final class DiffusionPathCompleteController extends DiffusionController { } $query_path = $request->getStr('q'); - $query_path = ltrim($query_path, '/'); if (preg_match('@/$@', $query_path)) { $query_dir = $query_path; } else { - $query_dir = dirname($query_path); - if ($query_dir == '.') { - $query_dir = ''; - } + $query_dir = dirname($query_path).'/'; } + $query_dir = ltrim($query_dir, '/'); $drequest = DiffusionRequest::newFromDictionary( array(