From a577906470e74a1cbf100a4e5f81deec91e64da8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 17 Feb 2011 23:52:11 -0600 Subject: redirect to the edit page for nonexistent pages --- lib/Narwhal/Component/Wiki.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Narwhal/Component/Wiki.pm b/lib/Narwhal/Component/Wiki.pm index e2a8ea7..1139301 100644 --- a/lib/Narwhal/Component/Wiki.pm +++ b/lib/Narwhal/Component/Wiki.pm @@ -8,8 +8,16 @@ sub page { my ($req, $page_name) = @_; my $page = $self->lookup("page:$page_name"); - return $req->new_response(404) - unless $page; + if (!$page) { + my $res = $req->new_response(303); + $res->location( + $req->uri_for({ + action => 'edit', + page_name => $page_name, + }) + ); + return $res; + } $self->render( $req, -- cgit v1.2.3-54-g00ecf