Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionController.php
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | private function loadContext(array $options) { | ||||
| if (!$drequest) { | if (!$drequest) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| // If the client is making a request like "/diffusion/1/...", but the | // If the client is making a request like "/diffusion/1/...", but the | ||||
| // repository has a different canonical path like "/diffusion/XYZ/...", | // repository has a different canonical path like "/diffusion/XYZ/...", | ||||
| // redirect them to the canonical path. | // redirect them to the canonical path. | ||||
| // Skip this redirect if the request is an AJAX request, like the requests | |||||
| // that Owners makes to complete and validate paths. | |||||
| if (!$request->isAjax()) { | |||||
| $request_path = $request->getPath(); | $request_path = $request->getPath(); | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $canonical_path = $repository->getCanonicalPath($request_path); | $canonical_path = $repository->getCanonicalPath($request_path); | ||||
| if ($canonical_path !== null) { | if ($canonical_path !== null) { | ||||
| if ($canonical_path != $request_path) { | if ($canonical_path != $request_path) { | ||||
| return id(new AphrontRedirectResponse())->setURI($canonical_path); | return id(new AphrontRedirectResponse())->setURI($canonical_path); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| $this->diffusionRequest = $drequest; | $this->diffusionRequest = $drequest; | ||||
| return null; | return null; | ||||
| } | } | ||||
| protected function getDiffusionBlobFromRequest(AphrontRequest $request) { | protected function getDiffusionBlobFromRequest(AphrontRequest $request) { | ||||
| return $request->getURIData('dblob'); | return $request->getURIData('dblob'); | ||||
| ▲ Show 20 Lines • Show All 479 Lines • Show Last 20 Lines | |||||