1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

404 older-style Phame URIs properly

Summary: Ref T9968. Some of the crumb/route handling wasn't quite tight enough and could hit a fatal.

Test Plan: Hit previously-fataling URI, got a 404 instead.

Reviewers: chad

Reviewed By: chad

Subscribers: starruler

Maniphest Tasks: T9968

Differential Revision: https://secure.phabricator.com/D14747
This commit is contained in:
epriestley 2015-12-11 17:27:48 -08:00
parent efb6bb3dcf
commit dbdd702702
2 changed files with 15 additions and 13 deletions

View file

@ -42,7 +42,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
// NOTE: The live routes include an initial "/", so leave it off
// this route.
'(?P<live>live)/(?P<blogID>[^/]+)' => $this->getLiveRoutes(),
'(?P<live>live)/(?P<blogID>\d+)' => $this->getLiveRoutes(),
'post/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController',
'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController',
@ -61,7 +61,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhameBlogListController',
'archive/(?P<id>[^/]+)/' => 'PhameBlogArchiveController',
'edit/(?P<id>[^/]+)/' => 'PhameBlogEditController',
'view/(?P<blogID>[^/]+)/' => 'PhameBlogViewController',
'view/(?P<blogID>\d+)/' => 'PhameBlogViewController',
'manage/(?P<id>[^/]+)/' => 'PhameBlogManageController',
'feed/(?P<id>[^/]+)/' => 'PhameBlogFeedController',
'new/' => 'PhameBlogEditController',
@ -92,7 +92,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
return array(
'/' => array(
'' => 'PhameBlogViewController',
'post/(?P<id>[^/]+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController',
'post/(?P<id>\d+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController',
),
);
}

View file

@ -163,21 +163,23 @@ abstract class PhameLiveController extends PhameController {
$crumbs->setBorder(true);
if ($post) {
if ($is_live) {
if ($is_external) {
$blog_uri = $blog->getExternalLiveURI();
if ($blog) {
if ($post) {
if ($is_live) {
if ($is_external) {
$blog_uri = $blog->getExternalLiveURI();
} else {
$blog_uri = $blog->getInternalLiveURI();
}
} else {
$blog_uri = $blog->getInternalLiveURI();
$blog_uri = $blog->getViewURI();
}
} else {
$blog_uri = $blog->getViewURI();
$blog_uri = null;
}
} else {
$blog_uri = null;
}
$crumbs->addTextCrumb($blog->getName(), $blog_uri);
$crumbs->addTextCrumb($blog->getName(), $blog_uri);
}
if ($post) {
$crumbs->addTextCrumb($post->getTitle());