1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Fix an issue with browsing repositories that have README, etc

Summary: D3533 changed the path for files at root from, e.g., "README" to "/README", which fatals when we try to `git cat-file` it.

Test Plan:
This no longer happens:

{F24874}

Viewed a directory in browse without a trailing slash in the URL.

Reviewers: vrana, nh

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D4016
This commit is contained in:
epriestley 2012-11-21 16:56:05 -08:00
parent 4d7b441834
commit f4fa968770

View file

@ -60,6 +60,12 @@ final class DiffusionGitBrowseQuery extends DiffusionBrowseQuery {
$submodules = array();
if (strlen($path)) {
$prefix = rtrim($path, '/').'/';
} else {
$prefix = '';
}
$results = array();
foreach (explode("\0", rtrim($stdout)) as $line) {
@ -83,7 +89,7 @@ final class DiffusionGitBrowseQuery extends DiffusionBrowseQuery {
}
}
$result->setFullPath(rtrim($path, '/').'/'.$name);
$result->setFullPath($prefix.$name);
$result->setPath($name);
$result->setHash($hash);
$result->setFileType($file_type);