Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15366052
D21528.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21528.diff
View Options
diff --git a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
--- a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
@@ -37,7 +37,7 @@
$repository = $drequest->getRepository();
$path = $request->getValue('path');
- if (!strlen($path)) {
+ if (!strlen($path) || $path === '/') {
$path = null;
}
@@ -49,12 +49,13 @@
if ($path === null) {
// Fast path to improve the performance of the repository view; we know
// the root is always a tree at any commit and always exists.
- $stdout = 'tree';
+ $path_type = 'tree';
} else {
try {
list($stdout) = $repository->execxLocalCommand(
'cat-file -t -- %s',
sprintf('%s:%s', $commit, $path));
+ $path_type = trim($stdout);
} catch (CommandException $e) {
// The "cat-file" command may fail if the path legitimately does not
// exist, but it may also fail if the path is a submodule. This can
@@ -114,7 +115,7 @@
}
}
- if (trim($stdout) == 'blob') {
+ if ($path_type === 'blob') {
$result->setReasonForEmptyResultSet(
DiffusionBrowseResultSet::REASON_IS_FILE);
return $result;
@@ -130,6 +131,12 @@
'ls-tree -z -l %s --',
gitsprintf('%s', $commit));
} else {
+ if ($path_type === 'tree') {
+ $path = rtrim($path, '/').'/';
+ } else {
+ $path = rtrim($path, '/');
+ }
+
list($stdout) = $repository->execxLocalCommand(
'ls-tree -z -l %s -- %s',
gitsprintf('%s', $commit),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 2:20 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7588035
Default Alt Text
D21528.diff (1 KB)
Attached To
Mode
D21528: Correct Diffusion browse behavior when visiting a path URI with no trailing slash
Attached
Detach File
Event Timeline
Log In to Comment