1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 10:42:41 +01:00

When a URI fails lookup, just 404 if it's POST

Summary: It's rather confusing now since we'll "seamlessly" redirect you to the right URI, but drop the method and parameters.

Test Plan: Hit a bad URI with POST, got 404.

Reviewers: edward, btrahan

Reviewed By: btrahan

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1965
This commit is contained in:
epriestley 2012-03-20 15:46:17 -07:00
parent 06822c89f6
commit 9a5598118e

View file

@ -61,7 +61,10 @@ abstract class AphrontApplicationConfiguration {
// If we failed to match anything but don't have a trailing slash, try // If we failed to match anything but don't have a trailing slash, try
// to add a trailing slash and issue a redirect if that resolves. // to add a trailing slash and issue a redirect if that resolves.
list($controller_class, $uri_data) = $mapper->mapPath($path.'/'); list($controller_class, $uri_data) = $mapper->mapPath($path.'/');
if ($controller_class) {
// NOTE: For POST, just 404 instead of redirecting, since the redirect
// will be a GET without parameters.
if ($controller_class && !$request->isHTTPPost()) {
$uri = $request->getRequestURI()->setPath($path.'/'); $uri = $request->getRequestURI()->setPath($path.'/');
return $this->buildRedirectController($uri); return $this->buildRedirectController($uri);
} }