diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_browsequery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_browsequery_Method.php index 0066e68333..7c696df1b4 100644 --- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_browsequery_Method.php +++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_browsequery_Method.php @@ -100,19 +100,22 @@ final class ConduitAPI_diffusion_browsequery_Method $results = array(); foreach (explode("\0", rtrim($stdout)) as $line) { - if (substr_count($line, ' ') < 4) { + // NOTE: Limit to 5 components so we parse filenames with spaces in them + // correctly. + // NOTE: The output uses a mixture of tabs and one-or-more spaces to + // delimit fields. + $parts = preg_split('/\s+/', $line, 5); + if (count($parts) < 5) { throw new Exception( pht( - 'Expected " ", for ls-tree of '. + 'Expected " \t", for ls-tree of '. '"%s:%s", got: %s', $commit, $path, $line)); } - // NOTE: Limit to 5 components so we parse filenames with spaces in them - // correctly. - list($mode, $type, $hash, $size, $name) = preg_split('/\s+/', $line, 5); + list($mode, $type, $hash, $size, $name) = $parts; $path_result = new DiffusionRepositoryPath();