1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Better 404 for Phame

Summary: "Fixes" fatals on phacility.com blog. If post_id is either `0` or any other integer not in the blog system, show a normal Phame 404 with crumbs.

Test Plan: http://local.blog.phacility.com/post/0/last_published/, http://local.blog.phacility.com/post/999999/last_published/

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16192
This commit is contained in:
Chad Little 2016-06-28 20:17:04 -07:00
parent bf1352c0e4
commit 2b76785a13

View file

@ -87,7 +87,7 @@ abstract class PhameLiveController extends PhameController {
$this->isExternal = $is_external; $this->isExternal = $is_external;
$this->isLive = $is_live; $this->isLive = $is_live;
if ($post_id) { if (strlen($post_id)) {
$post_query = id(new PhamePostQuery()) $post_query = id(new PhamePostQuery())
->setViewer($viewer) ->setViewer($viewer)
->withIDs(array($post_id)); ->withIDs(array($post_id));
@ -104,6 +104,8 @@ abstract class PhameLiveController extends PhameController {
$post = $post_query->executeOne(); $post = $post_query->executeOne();
if (!$post) { if (!$post) {
// Not a valid Post
$this->blog = $blog;
return new Aphront404Response(); return new Aphront404Response();
} }