1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-23 13:08:18 +01:00

Replace "getRequestURI()->setQueryParams(array())" with "getPath()"

Summary:
Ref T13250. A handful of callsites are doing `getRequestURI()` + `setQueryParams(array())` to get a bare request path.

They can just use `getPath()` instead.

Test Plan: See inlines.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13250

Differential Revision: https://secure.phabricator.com/D20150
This commit is contained in:
epriestley 2019-02-12 08:07:10 -08:00
parent 00ffb190cc
commit fcd85b6d7b
5 changed files with 9 additions and 15 deletions

View file

@ -32,22 +32,21 @@ final class AphrontAjaxResponse extends AphrontResponse {
}
public function buildResponseString() {
$request = $this->getRequest();
$console = $this->getConsole();
if ($console) {
// NOTE: We're stripping query parameters here both for readability and
// to mitigate BREACH and similar attacks. The parameters are available
// in the "Request" tab, so this should not impact usability. See T3684.
$uri = $this->getRequest()->getRequestURI();
$uri = new PhutilURI($uri);
$uri->setQueryParams(array());
$path = $request->getPath();
Javelin::initBehavior(
'dark-console',
array(
'uri' => (string)$uri,
'key' => $console->getKey($this->getRequest()),
'uri' => $path,
'key' => $console->getKey($request),
'color' => $console->getColor(),
'quicksand' => $this->getRequest()->isQuicksand(),
'quicksand' => $request->isQuicksand(),
));
}
@ -60,7 +59,6 @@ final class AphrontAjaxResponse extends AphrontResponse {
$response = CelerityAPI::getStaticResourceResponse();
$request = $this->getRequest();
if ($request) {
$viewer = $request->getViewer();
if ($viewer) {

View file

@ -11,8 +11,7 @@ final class PhabricatorChatLogChannelLogController
$viewer = $request->getViewer();
$id = $request->getURIData('channelID');
$uri = clone $request->getRequestURI();
$uri->setQueryParams(array());
$uri = new PhutilURI($request->getPath());
$pager = new AphrontCursorPagerView();
$pager->setURI($uri);

View file

@ -54,8 +54,7 @@ final class PhabricatorMetaMTAApplicationEmailPanel
return new Aphront404Response();
}
$uri = $request->getRequestURI();
$uri->setQueryParams(array());
$uri = new PhutilURI($request->getPath());
$new = $request->getStr('new');
$edit = $request->getInt('edit');

View file

@ -31,8 +31,7 @@ final class PhabricatorEmailAddressesSettingsPanel
$user = $this->getUser();
$editable = PhabricatorEnv::getEnvConfig('account.editable');
$uri = $request->getRequestURI();
$uri->setQueryParams(array());
$uri = new PhutilURI($request->getPath());
if ($editable) {
$new = $request->getStr('new');

View file

@ -1279,8 +1279,7 @@ abstract class PhabricatorEditEngine
$fields = $this->willBuildEditForm($object, $fields);
$request_path = $request->getRequestURI()
->setQueryParams(array());
$request_path = $request->getPath();
$form = id(new AphrontFormView())
->setUser($viewer)