From c383e09b2d8fb561b221da7636c394920b7b1240 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 5 Apr 2010 08:52:05 -0700 Subject: [PATCH] Backported error handling patch. Thanks to autarch for reporting the bug. Will backport. --- lib/Bric/App/AccessHandler.pm | 4 +--- lib/Bric/App/PreviewHandler.pm | 9 +-------- lib/Bric/Changes.pod | 10 ++++++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/Bric/App/AccessHandler.pm b/lib/Bric/App/AccessHandler.pm index 478d92aae..a44c880b0 100644 --- a/lib/Bric/App/AccessHandler.pm +++ b/lib/Bric/App/AccessHandler.pm @@ -291,10 +291,8 @@ B NONE. sub handle_err { my ($r, $err) = @_; # Set the filename for the error element. - my $uri = $r->uri; - (my $fn = $r->filename) =~ s/$uri/${\ERROR_URI}/; $r->uri(ERROR_URI); - $r->filename($fn); + $r->filename(Bric::App::Handler::ERROR_FILE); $err = Bric::Util::Fault::Exception::AP->new( error => 'Error executing AccessHandler', diff --git a/lib/Bric/App/PreviewHandler.pm b/lib/Bric/App/PreviewHandler.pm index 1eef292d1..3ef1105b1 100644 --- a/lib/Bric/App/PreviewHandler.pm +++ b/lib/Bric/App/PreviewHandler.pm @@ -58,13 +58,6 @@ use Apache::Log; # Function and Closure Prototypes ################################################################################ -################################################################################ -# Constants -################################################################################ -use constant ERROR_FILE => - Bric::Util::Trans::FS->cat_dir(MASON_COMP_ROOT->[0][1], - Bric::Util::Trans::FS->split_uri(ERROR_URI)); - ################################################################################ # Fields ################################################################################ @@ -207,7 +200,7 @@ sub handle_err { my ($r, $err) = @_; $r->uri(ERROR_URI); - $r->filename(ERROR_FILE); + $r->filename(Bric::App::Handler::ERROR_FILE); $err = Bric::Util::Fault::Exception::AP->new( error => 'Error executing PreviewHandler', diff --git a/lib/Bric/Changes.pod b/lib/Bric/Changes.pod index 06c704ef8..fe0f2d259 100644 --- a/lib/Bric/Changes.pod +++ b/lib/Bric/Changes.pod @@ -110,6 +110,16 @@ The C method of L now works when creating a link to a story on a different site and the protocol for the output channel is not set. It defaults to "http://" for the protocol. [David] +=item * + +Fixed error handling in the access handler so that it works when a URI is a +directory. Thanks to Dave Rolsky for the initial patch. [David] + +=item * + +Updated session error handling to recognize new error message from +Apache::Session. [Dave Rolsky] + =back =head1 VERSION 1.10.9 (2010-01-28)