mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Fix broken suggestion/validation for Owners paths in repositories with short names
Summary: Depends on D19189. Ref T12590. The "validate" and "complete" endpoints for this UI could incorrectly return redirect responses. These aren't critical to the behavior of Owners, but they're nice to have, and shouldn't redirect. Instead, skip the canonicalizing redirect for AJAX requests. Test Plan: Edited Owners paths in a repository with a short name, got completion/validation again. Maniphest Tasks: T12590 Differential Revision: https://secure.phabricator.com/D19190
This commit is contained in:
parent
ab0ac7f61b
commit
b41a0e6ddd
1 changed files with 11 additions and 6 deletions
|
@ -69,13 +69,18 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
// repository has a different canonical path like "/diffusion/XYZ/...",
|
||||
// redirect them to the canonical path.
|
||||
|
||||
$request_path = $request->getPath();
|
||||
$repository = $drequest->getRepository();
|
||||
// Skip this redirect if the request is an AJAX request, like the requests
|
||||
// that Owners makes to complete and validate paths.
|
||||
|
||||
$canonical_path = $repository->getCanonicalPath($request_path);
|
||||
if ($canonical_path !== null) {
|
||||
if ($canonical_path != $request_path) {
|
||||
return id(new AphrontRedirectResponse())->setURI($canonical_path);
|
||||
if (!$request->isAjax()) {
|
||||
$request_path = $request->getPath();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$canonical_path = $repository->getCanonicalPath($request_path);
|
||||
if ($canonical_path !== null) {
|
||||
if ($canonical_path != $request_path) {
|
||||
return id(new AphrontRedirectResponse())->setURI($canonical_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue